diff --git a/.travis.yml b/.travis.yml index 50b676f2..d286068e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ addons: packages: - redis-server go: +- 1.8.x - 1.9 - tip services: diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 4ae9f3e0..00000000 --- a/Gopkg.lock +++ /dev/null @@ -1,368 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "cloud.google.com/go" - packages = ["compute/metadata"] - revision = "eaddaf6dd7ee35fd3c2420c8d27478db176b0485" - version = "v0.15.0" - -[[projects]] - branch = "master" - name = "github.com/Gurpartap/logrus-stack" - packages = ["."] - revision = "89c00d8a28f43c567d92eb81a2945301a6a9fbb9" - -[[projects]] - branch = "master" - name = "github.com/NYTimes/encoding-wrapper" - packages = ["elementalconductor","encodingcom"] - revision = "36fb9db91f136e65449cdb64497f28ec0b9f6685" - -[[projects]] - branch = "master" - name = "github.com/NYTimes/gizmo" - packages = ["config","config/metrics","server","web"] - revision = "d36c7282fef91965272dac8b3e418902e3f70938" - -[[projects]] - branch = "master" - name = "github.com/NYTimes/gziphandler" - packages = ["."] - revision = "97ae7fbaf81620fe97840685304a78a306a39c64" - -[[projects]] - branch = "master" - name = "github.com/NYTimes/logrotate" - packages = ["."] - revision = "2b6e866fd507ff9d9b0c4246873004c650fb7aea" - -[[projects]] - name = "github.com/VividCortex/gohistogram" - packages = ["."] - revision = "51564d9861991fb0ad0f531c99ef602d0f9866e6" - version = "v1.0.0" - -[[projects]] - name = "github.com/aws/aws-sdk-go" - packages = ["aws","aws/awserr","aws/awsutil","aws/client","aws/client/metadata","aws/corehandlers","aws/credentials","aws/credentials/ec2rolecreds","aws/credentials/endpointcreds","aws/credentials/stscreds","aws/defaults","aws/ec2metadata","aws/endpoints","aws/request","aws/session","aws/signer/v4","internal/shareddefaults","private/protocol","private/protocol/json/jsonutil","private/protocol/jsonrpc","private/protocol/query","private/protocol/query/queryutil","private/protocol/rest","private/protocol/restjson","private/protocol/xml/xmlutil","service/elastictranscoder","service/elastictranscoder/elastictranscoderiface","service/sts"] - revision = "209e63d002840d9ed94159e6639216a53b7cc28b" - version = "v1.12.16" - -[[projects]] - branch = "master" - name = "github.com/beorn7/perks" - packages = ["quantile"] - revision = "4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9" - -[[projects]] - name = "github.com/bitmovin/bitmovin-go" - packages = ["bitmovin","bitmovintypes","models","services"] - revision = "ac1714314b80cea96b013a88262d8e3fe0a93237" - version = "v1.5.1" - -[[projects]] - branch = "master" - name = "github.com/facebookgo/stack" - packages = ["."] - revision = "751773369052141c013c6e827a71e8f35c07879c" - -[[projects]] - branch = "master" - name = "github.com/flavioribeiro/zencoder" - packages = ["."] - revision = "74587454438274fd125c548b953cd15ad2264cff" - -[[projects]] - name = "github.com/fluent/fluent-logger-golang" - packages = ["fluent"] - revision = "28bdb662295c1b7aca09c1a4edbf9430010775a9" - version = "v1.2.1" - -[[projects]] - branch = "master" - name = "github.com/fsouza/ctxlogger" - packages = ["."] - revision = "19d92a651a3df41492d305439c41734e3383dac0" - -[[projects]] - name = "github.com/go-ini/ini" - packages = ["."] - revision = "5b3e00af70a9484542169a976dcab8d03e601a17" - version = "v1.30.0" - -[[projects]] - name = "github.com/go-kit/kit" - packages = ["log","metrics","metrics/discard","metrics/dogstatsd","metrics/expvar","metrics/generic","metrics/graphite","metrics/influx","metrics/internal/lv","metrics/internal/ratemap","metrics/prometheus","metrics/provider","metrics/statsd","util/conn"] - revision = "4dc7be5d2d12881735283bcab7352178e190fc71" - version = "v0.6.0" - -[[projects]] - name = "github.com/go-logfmt/logfmt" - packages = ["."] - revision = "390ab7935ee28ec6b286364bba9b4dd6410cb3d5" - version = "v0.3.0" - -[[projects]] - name = "github.com/go-stack/stack" - packages = ["."] - revision = "817915b46b97fd7bb80e8ab6b69f01a53ac3eebf" - version = "v1.6.0" - -[[projects]] - branch = "master" - name = "github.com/golang/protobuf" - packages = ["proto","ptypes","ptypes/any","ptypes/duration","ptypes/timestamp"] - revision = "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" - -[[projects]] - name = "github.com/google/gops" - packages = ["agent","internal","signal"] - revision = "57e77c5c37da1f4e1af49f9d1fe760f146c1579e" - version = "v0.3.2" - -[[projects]] - name = "github.com/gorilla/context" - packages = ["."] - revision = "1ea25387ff6f684839d82767c1733ff4d4d15d0a" - version = "v1.1" - -[[projects]] - name = "github.com/gorilla/handlers" - packages = ["."] - revision = "a4043c62cc2329bacda331d33fc908ab11ef0ec3" - version = "v1.2.1" - -[[projects]] - name = "github.com/gorilla/mux" - packages = ["."] - revision = "24fca303ac6da784b9e8269f724ddeb0b2eea5e7" - version = "v1.5.0" - -[[projects]] - name = "github.com/hashicorp/consul" - packages = ["api"] - revision = "51ea240df8476e02215d53fbfad5838bf0d44d21" - version = "v1.0.0" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-cleanhttp" - packages = ["."] - revision = "3573b8b52aa7b37b9358d966a898feb387f62437" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-rootcerts" - packages = ["."] - revision = "6bb64b370b90e7ef1fa532be9e591a81c3493e00" - -[[projects]] - name = "github.com/hashicorp/serf" - packages = ["coordinate"] - revision = "d6574a5bb1226678d7010325fb6c985db20ee458" - version = "v0.8.1" - -[[projects]] - branch = "master" - name = "github.com/hybrik/hybrik-sdk-go" - packages = ["."] - revision = "c2eee0e66af9e9467c03694da016859ecf32f68e" - -[[projects]] - name = "github.com/influxdata/influxdb" - packages = ["client/v2","models","pkg/escape"] - revision = "a7c3d3c0f7b74f71919047adbc4933460967a576" - version = "v1.3.6" - -[[projects]] - name = "github.com/jmespath/go-jmespath" - packages = ["."] - revision = "0b12d6b5" - -[[projects]] - branch = "master" - name = "github.com/julienschmidt/httprouter" - packages = ["."] - revision = "975b5c4c7c21c0e3d2764200bf2aa8e34657ae6e" - -[[projects]] - branch = "master" - name = "github.com/kardianos/osext" - packages = ["."] - revision = "ae77be60afb1dcacde03767a8c37337fad28ac14" - -[[projects]] - name = "github.com/kelseyhightower/envconfig" - packages = ["."] - revision = "f611eb38b3875cc3bd991ca91c51d06446afa14c" - version = "v1.3.0" - -[[projects]] - branch = "master" - name = "github.com/knq/jwt" - packages = [".","bearer","gserviceaccount"] - revision = "0d31af81a9cbb15756a576eef5054666a1266bb6" - -[[projects]] - branch = "master" - name = "github.com/knq/pemutil" - packages = ["."] - revision = "e3a451ffce37adffddb0d727af326e5bd1e53fdf" - -[[projects]] - branch = "master" - name = "github.com/knq/sdhook" - packages = ["."] - revision = "f7fbc484622bce1766aa251557dc76cb5d7d068f" - -[[projects]] - branch = "master" - name = "github.com/kr/logfmt" - packages = ["."] - revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0" - -[[projects]] - branch = "master" - name = "github.com/kr/pretty" - packages = ["."] - revision = "cfb55aafdaf3ec08f0db22699ab822c50091b1c4" - -[[projects]] - branch = "master" - name = "github.com/kr/text" - packages = ["."] - revision = "7cafcd837844e784b526369c9bce262804aebc60" - -[[projects]] - branch = "master" - name = "github.com/marzagao/logrus-env" - packages = ["."] - revision = "367f558eb6f39787f5c090a2618a842557961a9e" - -[[projects]] - name = "github.com/matttproud/golang_protobuf_extensions" - packages = ["pbutil"] - revision = "3247c84500bff8d9fb6d579d800f20b3e091582c" - version = "v1.0.0" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/go-homedir" - packages = ["."] - revision = "b8bc1bf767474819792c23f32d8286a45736f1c6" - -[[projects]] - branch = "master" - name = "github.com/nu7hatch/gouuid" - packages = ["."] - revision = "179d4d0c4d8d407a32af483c2354df1d2c91e6c3" - -[[projects]] - branch = "master" - name = "github.com/philhofer/fwd" - packages = ["."] - revision = "bb6d471dc95d4fe11e432687f8b70ff496cf3136" - -[[projects]] - name = "github.com/prometheus/client_golang" - packages = ["prometheus"] - revision = "c5b7fccd204277076155f10851dad72b76a49317" - version = "v0.8.0" - -[[projects]] - branch = "master" - name = "github.com/prometheus/client_model" - packages = ["go"] - revision = "6f3806018612930941127f2a7c6c453ba2c527d2" - -[[projects]] - branch = "master" - name = "github.com/prometheus/common" - packages = ["expfmt","internal/bitbucket.org/ww/goautoneg","model"] - revision = "1bab55dd05dbff384524a6a1c99006d9eb5f139b" - -[[projects]] - branch = "master" - name = "github.com/prometheus/procfs" - packages = [".","xfs"] - revision = "a6e9df898b1336106c743392c48ee0b71f5c4efa" - -[[projects]] - name = "github.com/sirupsen/logrus" - packages = ["."] - revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e" - version = "v1.0.3" - -[[projects]] - name = "github.com/tinylib/msgp" - packages = ["msgp"] - revision = "b2b6a672cf1e5b90748f79b8b81fc8c5cf0571a1" - version = "1.0.2" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["ssh/terminal"] - revision = "2509b142fb2b797aa7587dad548f113b2c0f20ce" - -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = ["context","context/ctxhttp","http2","http2/hpack","idna","internal/timeseries","lex/httplex","trace"] - revision = "4b14673ba32bee7f5ac0f990a48f033919fd418b" - -[[projects]] - branch = "master" - name = "golang.org/x/oauth2" - packages = [".","google","internal","jws","jwt"] - revision = "bb50c06baba3d0c76f9d125c0719093e315b5b44" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix","windows"] - revision = "a1a1f1746d156bbc9954f29134b20ed4ce2752f1" - -[[projects]] - branch = "master" - name = "golang.org/x/text" - packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"] - revision = "6eab0e8f74e86c598ec3b6fad4888e0c11482d48" - -[[projects]] - branch = "master" - name = "google.golang.org/api" - packages = ["clouderrorreporting/v1beta1","gensupport","googleapi","googleapi/internal/uritemplates","logging/v2"] - revision = "0bf971c28aa2a58853c3ea0a9bc60c9b3761234a" - -[[projects]] - name = "google.golang.org/appengine" - packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/urlfetch","urlfetch"] - revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a" - version = "v1.0.0" - -[[projects]] - branch = "master" - name = "google.golang.org/genproto" - packages = ["googleapis/rpc/status"] - revision = "f676e0f3ac6395ff1a529ae59a6670878a8371a6" - -[[projects]] - name = "google.golang.org/grpc" - packages = [".","balancer","codes","connectivity","credentials","grpclb/grpc_lb_v1/messages","grpclog","internal","keepalive","metadata","naming","peer","resolver","stats","status","tap","transport"] - revision = "f7bf885db0b7479a537ec317c6e48ce53145f3db" - version = "v1.7.0" - -[[projects]] - name = "gopkg.in/redis.v5" - packages = [".","internal","internal/consistenthash","internal/hashtag","internal/pool","internal/proto"] - revision = "a16aeec10ff407b1e7be6dd35797ccf5426ef0f0" - version = "v5.2.9" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "80d68e8315c3f1a457d8bfedbd188368038b94aba5266b80224a6ea682479064" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 997b4e5a..00000000 --- a/Gopkg.toml +++ /dev/null @@ -1,63 +0,0 @@ -[[constraint]] - branch = "master" - name = "github.com/Gurpartap/logrus-stack" - -[[constraint]] - branch = "master" - name = "github.com/NYTimes/encoding-wrapper" - -[[constraint]] - branch = "master" - name = "github.com/NYTimes/gizmo" - -[[constraint]] - branch = "master" - name = "github.com/NYTimes/gziphandler" - -[[constraint]] - name = "github.com/aws/aws-sdk-go" - version = "1.12.16" - -[[constraint]] - name = "github.com/bitmovin/bitmovin-go" - version = "1.5.1" - -[[constraint]] - branch = "master" - name = "github.com/flavioribeiro/zencoder" - -[[constraint]] - branch = "master" - name = "github.com/fsouza/ctxlogger" - -[[constraint]] - name = "github.com/google/gops" - version = "0.3.2" - -[[constraint]] - branch = "master" - name = "github.com/hybrik/hybrik-sdk-go" - -[[constraint]] - branch = "master" - name = "github.com/knq/sdhook" - -[[constraint]] - branch = "master" - name = "github.com/kr/pretty" - -[[constraint]] - branch = "master" - name = "github.com/marzagao/logrus-env" - -[[constraint]] - name = "github.com/sirupsen/logrus" - version = "1.0.3" - -[[constraint]] - name = "gopkg.in/redis.v5" - version = "5.2.9" - -[[override]] - branch = "master" - name = "github.com/julienschmidt/httprouter" diff --git a/Makefile b/Makefile index bbc60a0b..6cfa515c 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ lint: testdeps go get -d -t ./... go build -i go list -f '{{.TestImports}}' ./... | sed -e 's/\[\(.*\)\]/\1/' | tr ' ' '\n' | grep '^.*\..*/.*$$' | xargs go install - gometalinter -j 2 --enable=misspell --enable=gofmt --enable=unused --disable=dupl --disable=errcheck --disable=gas --disable=interfacer --disable=gocyclo --deadline=10m --tests --vendor ./... + gometalinter -j 2 --enable=misspell --enable=gofmt --enable=unused --disable=dupl --disable=errcheck --disable=gas --disable=interfacer --disable=gocyclo --deadline=10m --tests ./... gotest: testdeps go test ./... diff --git a/vendor/cloud.google.com/go/.travis.yml b/vendor/cloud.google.com/go/.travis.yml deleted file mode 100644 index 8c769d71..00000000 --- a/vendor/cloud.google.com/go/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -sudo: false -language: go -go: -- 1.6 -- 1.7 -- 1.8 -install: -- go get -v cloud.google.com/go/... -script: -- openssl aes-256-cbc -K $encrypted_a8b3f4fc85f4_key -iv $encrypted_a8b3f4fc85f4_iv -in key.json.enc -out key.json -d -- GCLOUD_TESTS_GOLANG_PROJECT_ID="dulcet-port-762" GCLOUD_TESTS_GOLANG_KEY="$(pwd)/key.json" - ./run-tests.sh $TRAVIS_COMMIT -env: - matrix: - # The GCLOUD_TESTS_API_KEY environment variable. - secure: VdldogUOoubQ60LhuHJ+g/aJoBiujkSkWEWl79Zb8cvQorcQbxISS+JsOOp4QkUOU4WwaHAm8/3pIH1QMWOR6O78DaLmDKi5Q4RpkVdCpUXy+OAfQaZIcBsispMrjxLXnqFjo9ELnrArfjoeCTzaX0QTCfwQwVmigC8rR30JBKI= diff --git a/vendor/cloud.google.com/go/AUTHORS b/vendor/cloud.google.com/go/AUTHORS deleted file mode 100644 index c364af1d..00000000 --- a/vendor/cloud.google.com/go/AUTHORS +++ /dev/null @@ -1,15 +0,0 @@ -# This is the official list of cloud authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS files. -# See the latter for an explanation. - -# Names should be added to this file as: -# Name or Organization -# The email address is not required for organizations. - -Filippo Valsorda -Google Inc. -Ingo Oeser -Palm Stone Games, Inc. -Paweł Knap -Péter Szilágyi -Tyler Treat diff --git a/vendor/cloud.google.com/go/CONTRIBUTING.md b/vendor/cloud.google.com/go/CONTRIBUTING.md deleted file mode 100644 index f99b50d0..00000000 --- a/vendor/cloud.google.com/go/CONTRIBUTING.md +++ /dev/null @@ -1,144 +0,0 @@ -# Contributing - -1. Sign one of the contributor license agreements below. -1. `go get golang.org/x/review/git-codereview` to install the code reviewing tool. - 1. You will need to ensure that your `GOBIN` directory (by default - `$GOPATH/bin`) is in your `PATH` so that git can find the command. - 1. If you would like, you may want to set up aliases for git-codereview, - such that `git codereview change` becomes `git change`. See the - [godoc](https://godoc.org/golang.org/x/review/git-codereview) for details. - 1. Should you run into issues with the git-codereview tool, please note - that all error messages will assume that you have set up these - aliases. -1. Get the cloud package by running `go get -d cloud.google.com/go`. - 1. If you have already checked out the source, make sure that the remote git - origin is https://code.googlesource.com/gocloud: - - git remote set-url origin https://code.googlesource.com/gocloud -1. Make sure your auth is configured correctly by visiting - https://code.googlesource.com, clicking "Generate Password", and following - the directions. -1. Make changes and create a change by running `git codereview change `, -provide a commit message, and use `git codereview mail` to create a Gerrit CL. -1. Keep amending to the change with `git codereview change` and mail as your receive -feedback. Each new mailed amendment will create a new patch set for your change in Gerrit. - -## Integration Tests - -In addition to the unit tests, you may run the integration test suite. - -To run the integrations tests, creating and configuration of a project in the -Google Developers Console is required. - -After creating a project, you must [create a service account](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount). -Ensure the project-level **Owner** [IAM role](console.cloud.google.com/iam-admin/iam/project) -(or **Editor** and **Logs Configuration Writer** roles) are added to the -service account. - -Once you create a project, set the following environment variables to be able to -run the against the actual APIs. - -- **GCLOUD_TESTS_GOLANG_PROJECT_ID**: Developers Console project's ID (e.g. bamboo-shift-455) -- **GCLOUD_TESTS_GOLANG_KEY**: The path to the JSON key file. -- **GCLOUD_TESTS_API_KEY**: Your API key. - -Firestore requires a different project and key: - -- **GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID**: Developers Console project's ID - supporting Firestore -- **GCLOUD_TESTS_GOLANG_FIRESTORE_KEY**: The path to the JSON key file. - -Install the [gcloud command-line tool][gcloudcli] to your machine and use it -to create some resources used in integration tests. - -From the project's root directory: - -``` sh -# Set the default project in your env. -$ gcloud config set project $GCLOUD_TESTS_GOLANG_PROJECT_ID - -# Authenticate the gcloud tool with your account. -$ gcloud auth login - -# Create the indexes used in the datastore integration tests. -$ gcloud preview datastore create-indexes datastore/testdata/index.yaml - -# Create a Google Cloud storage bucket with the same name as your test project, -# and with the Stackdriver Logging service account as owner, for the sink -# integration tests in logging. -$ gsutil mb gs://$GCLOUD_TESTS_GOLANG_PROJECT_ID -$ gsutil acl ch -g cloud-logs@google.com:O gs://$GCLOUD_TESTS_GOLANG_PROJECT_ID - -# Create a Spanner instance for the spanner integration tests. -$ gcloud beta spanner instances create go-integration-test --config regional-us-central1 --nodes 1 --description 'Instance for go client test' -# NOTE: Spanner instances are priced by the node-hour, so you may want to delete -# the instance after testing with 'gcloud beta spanner instances delete'. -``` - -Once you've set the environment variables, you can run the integration tests by -running: - -``` sh -$ go test -v cloud.google.com/go/... -``` - -## Contributor License Agreements - -Before we can accept your pull requests you'll need to sign a Contributor -License Agreement (CLA): - -- **If you are an individual writing original source code** and **you own the -- intellectual property**, then you'll need to sign an [individual CLA][indvcla]. -- **If you work for a company that wants to allow you to contribute your work**, -then you'll need to sign a [corporate CLA][corpcla]. - -You can sign these electronically (just scroll to the bottom). After that, -we'll be able to accept your pull requests. - -## Contributor Code of Conduct - -As contributors and maintainers of this project, -and in the interest of fostering an open and welcoming community, -we pledge to respect all people who contribute through reporting issues, -posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. - -We are committed to making participation in this project -a harassment-free experience for everyone, -regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, -such as physical or electronic -addresses, without explicit permission -* Other unethical or unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct. -By adopting this Code of Conduct, -project maintainers commit themselves to fairly and consistently -applying these principles to every aspect of managing this project. -Project maintainers who do not follow or enforce the Code of Conduct -may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior -may be reported by opening an issue -or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, -available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) - -[gcloudcli]: https://developers.google.com/cloud/sdk/gcloud/ -[indvcla]: https://developers.google.com/open-source/cla/individual -[corpcla]: https://developers.google.com/open-source/cla/corporate diff --git a/vendor/cloud.google.com/go/CONTRIBUTORS b/vendor/cloud.google.com/go/CONTRIBUTORS deleted file mode 100644 index d4b376c7..00000000 --- a/vendor/cloud.google.com/go/CONTRIBUTORS +++ /dev/null @@ -1,37 +0,0 @@ -# People who have agreed to one of the CLAs and can contribute patches. -# The AUTHORS file lists the copyright holders; this file -# lists people. For example, Google employees are listed here -# but not in AUTHORS, because Google holds the copyright. -# -# https://developers.google.com/open-source/cla/individual -# https://developers.google.com/open-source/cla/corporate -# -# Names should be added to this file as: -# Name - -# Keep the list alphabetically sorted. - -Alexis Hunt -Andreas Litt -Andrew Gerrand -Brad Fitzpatrick -Burcu Dogan -Dave Day -David Sansome -David Symonds -Filippo Valsorda -Glenn Lewis -Ingo Oeser -Johan Euphrosine -Jonathan Amsterdam -Luna Duclos -Magnus Hiie -Michael McGreevy -Omar Jarjur -Paweł Knap -Péter Szilágyi -Sarah Adams -Thanatat Tamtan -Toby Burress -Tuo Shan -Tyler Treat diff --git a/vendor/cloud.google.com/go/LICENSE b/vendor/cloud.google.com/go/LICENSE deleted file mode 100644 index a4c5efd8..00000000 --- a/vendor/cloud.google.com/go/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/cloud.google.com/go/MIGRATION.md b/vendor/cloud.google.com/go/MIGRATION.md deleted file mode 100644 index 791210de..00000000 --- a/vendor/cloud.google.com/go/MIGRATION.md +++ /dev/null @@ -1,54 +0,0 @@ -# Code Changes - -## v0.10.0 - -- pubsub: Replace - - ``` - sub.ModifyPushConfig(ctx, pubsub.PushConfig{Endpoint: "https://example.com/push"}) - ``` - - with - - ``` - sub.Update(ctx, pubsub.SubscriptionConfigToUpdate{ - PushConfig: &pubsub.PushConfig{Endpoint: "https://example.com/push"}, - }) - ``` - -- trace: traceGRPCServerInterceptor will be provided from *trace.Client. -Given an initialized `*trace.Client` named `tc`, instead of - - ``` - s := grpc.NewServer(grpc.UnaryInterceptor(trace.GRPCServerInterceptor(tc))) - ``` - - write - - ``` - s := grpc.NewServer(grpc.UnaryInterceptor(tc.GRPCServerInterceptor())) - ``` - -- trace trace.GRPCClientInterceptor will also provided from *trace.Client. -Instead of - - ``` - conn, err := grpc.Dial(srv.Addr, grpc.WithUnaryInterceptor(trace.GRPCClientInterceptor())) - ``` - - write - - ``` - conn, err := grpc.Dial(srv.Addr, grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor())) - ``` - -- trace: We removed the deprecated `trace.EnableGRPCTracing`. Use the gRPC -interceptor as a dial option as shown below when initializing Cloud package -clients: - - ``` - c, err := pubsub.NewClient(ctx, "project-id", option.WithGRPCDialOption(grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor()))) - if err != nil { - ... - } - ``` diff --git a/vendor/cloud.google.com/go/README.md b/vendor/cloud.google.com/go/README.md deleted file mode 100644 index 1e0e241d..00000000 --- a/vendor/cloud.google.com/go/README.md +++ /dev/null @@ -1,514 +0,0 @@ -# Google Cloud Client Libraries for Go - -[![GoDoc](https://godoc.org/cloud.google.com/go?status.svg)](https://godoc.org/cloud.google.com/go) - -Go packages for [Google Cloud Platform](https://cloud.google.com) services. - -``` go -import "cloud.google.com/go" -``` - -To install the packages on your system, - -``` -$ go get -u cloud.google.com/go/... -``` - -**NOTE:** Some of these packages are under development, and may occasionally -make backwards-incompatible changes. - -**NOTE:** Github repo is a mirror of [https://code.googlesource.com/gocloud](https://code.googlesource.com/gocloud). - - * [News](#news) - * [Supported APIs](#supported-apis) - * [Go Versions Supported](#go-versions-supported) - * [Authorization](#authorization) - * [Cloud Datastore](#cloud-datastore-) - * [Cloud Storage](#cloud-storage-) - * [Cloud Pub/Sub](#cloud-pub-sub-) - * [Cloud BigQuery](#cloud-bigquery-) - * [Stackdriver Logging](#stackdriver-logging-) - * [Cloud Spanner](#cloud-spanner-) - - -## News - -*v0.15.0* - -_October 3, 2017_ - -- firestore: beta release. See the - [announcement](https://firebase.googleblog.com/2017/10/introducing-cloud-firestore.html). - -- errorreporting: The existing package has been redesigned. - -- errors: This package has been removed. Use errorreporting. - - -_September 28, 2017_ - -*v0.14.0* - -- bigquery BREAKING CHANGES: - - Standard SQL is the default for queries and views. - - `Table.Create` takes `TableMetadata` as a second argument, instead of - options. - - `Dataset.Create` takes `DatasetMetadata` as a second argument. - - `DatasetMetadata` field `ID` renamed to `FullID` - - `TableMetadata` field `ID` renamed to `FullID` - -- Other bigquery changes: - - The client will append a random suffix to a provided job ID if you set - `AddJobIDSuffix` to true in a job config. - - Listing jobs is supported. - - Better retry logic. - -- vision, language, speech: clients are now stable - -- monitoring: client is now beta - -- profiler: - - Rename InstanceName to Instance, ZoneName to Zone - - Auto-detect service name and version on AppEngine. - -_September 8, 2017_ - -*v0.13.0* - -- bigquery: UseLegacySQL options for CreateTable and QueryConfig. Use these - options to continue using Legacy SQL after the client switches its default - to Standard SQL. - -- bigquery: Support for updating dataset labels. - -- bigquery: Set DatasetIterator.ProjectID to list datasets in a project other - than the client's. DatasetsInProject is no longer needed and is deprecated. - -- bigtable: Fail ListInstances when any zones fail. - -- spanner: support decoding of slices of basic types (e.g. []string, []int64, - etc.) - -- logging/logadmin: UpdateSink no longer creates a sink if it is missing - (actually a change to the underlying service, not the client) - -- profiler: Service and ServiceVersion replace Target in Config. - -_August 22, 2017_ - -*v0.12.0* - -- pubsub: Subscription.Receive now uses streaming pull. - -- pubsub: add Client.TopicInProject to access topics in a different project - than the client. - -- errors: renamed errorreporting. The errors package will be removed shortly. - -- datastore: improved retry behavior. - -- bigquery: support updates to dataset metadata, with etags. - -- bigquery: add etag support to Table.Update (BREAKING: etag argument added). - -- bigquery: generate all job IDs on the client. - -- storage: support bucket lifecycle configurations. - - -[Older news](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/old-news.md) - -## Supported APIs - -Google API | Status | Package ----------------------------------|--------------|----------------------------------------------------------- -[Datastore][cloud-datastore] | stable | [`cloud.google.com/go/datastore`][cloud-datastore-ref] -[Firestore][cloud-firestore] | beta | [`cloud.google.com/go/firestore`][cloud-firestore-ref] -[Storage][cloud-storage] | stable | [`cloud.google.com/go/storage`][cloud-storage-ref] -[Bigtable][cloud-bigtable] | beta | [`cloud.google.com/go/bigtable`][cloud-bigtable-ref] -[BigQuery][cloud-bigquery] | beta | [`cloud.google.com/go/bigquery`][cloud-bigquery-ref] -[Logging][cloud-logging] | stable | [`cloud.google.com/go/logging`][cloud-logging-ref] -[Monitoring][cloud-monitoring] | beta | [`cloud.google.com/go/monitoring/apiv3`][cloud-monitoring-ref] -[Pub/Sub][cloud-pubsub] | beta | [`cloud.google.com/go/pubsub`][cloud-pubsub-ref] -[Vision][cloud-vision] | stable | [`cloud.google.com/go/vision/apiv1`][cloud-vision-ref] -[Language][cloud-language] | stable | [`cloud.google.com/go/language/apiv1`][cloud-language-ref] -[Speech][cloud-speech] | stable | [`cloud.google.com/go/speech/apiv1`][cloud-speech-ref] -[Spanner][cloud-spanner] | beta | [`cloud.google.com/go/spanner`][cloud-spanner-ref] -[Translation][cloud-translation] | stable | [`cloud.google.com/go/translate`][cloud-translation-ref] -[Trace][cloud-trace] | alpha | [`cloud.google.com/go/trace`][cloud-trace-ref] -[Video Intelligence][cloud-video]| beta | [`cloud.google.com/go/videointelligence/apiv1beta1`][cloud-video-ref] -[ErrorReporting][cloud-errors] | alpha | [`cloud.google.com/go/errorreporting`][cloud-errors-ref] - - -> **Alpha status**: the API is still being actively developed. As a -> result, it might change in backward-incompatible ways and is not recommended -> for production use. -> -> **Beta status**: the API is largely complete, but still has outstanding -> features and bugs to be addressed. There may be minor backwards-incompatible -> changes where necessary. -> -> **Stable status**: the API is mature and ready for production use. We will -> continue addressing bugs and feature requests. - -Documentation and examples are available at -https://godoc.org/cloud.google.com/go - -Visit or join the -[google-api-go-announce group](https://groups.google.com/forum/#!forum/google-api-go-announce) -for updates on these packages. - -## Go Versions Supported - -We support the two most recent major versions of Go. If Google App Engine uses -an older version, we support that as well. You can see which versions are -currently supported by looking at the lines following `go:` in -[`.travis.yml`](.travis.yml). - -## Authorization - -By default, each API will use [Google Application Default Credentials][default-creds] -for authorization credentials used in calling the API endpoints. This will allow your -application to run in many environments without requiring explicit configuration. - -[snip]:# (auth) -```go -client, err := storage.NewClient(ctx) -``` - -To authorize using a -[JSON key file](https://cloud.google.com/iam/docs/managing-service-account-keys), -pass -[`option.WithServiceAccountFile`](https://godoc.org/google.golang.org/api/option#WithServiceAccountFile) -to the `NewClient` function of the desired package. For example: - -[snip]:# (auth-JSON) -```go -client, err := storage.NewClient(ctx, option.WithServiceAccountFile("path/to/keyfile.json")) -``` - -You can exert more control over authorization by using the -[`golang.org/x/oauth2`](https://godoc.org/golang.org/x/oauth2) package to -create an `oauth2.TokenSource`. Then pass -[`option.WithTokenSource`](https://godoc.org/google.golang.org/api/option#WithTokenSource) -to the `NewClient` function: -[snip]:# (auth-ts) -```go -tokenSource := ... -client, err := storage.NewClient(ctx, option.WithTokenSource(tokenSource)) -``` - -## Cloud Datastore [![GoDoc](https://godoc.org/cloud.google.com/go/datastore?status.svg)](https://godoc.org/cloud.google.com/go/datastore) - -- [About Cloud Datastore][cloud-datastore] -- [Activating the API for your project][cloud-datastore-activation] -- [API documentation][cloud-datastore-docs] -- [Go client documentation](https://godoc.org/cloud.google.com/go/datastore) -- [Complete sample program](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/datastore/tasks) - -### Example Usage - -First create a `datastore.Client` to use throughout your application: - -[snip]:# (datastore-1) -```go -client, err := datastore.NewClient(ctx, "my-project-id") -if err != nil { - log.Fatal(err) -} -``` - -Then use that client to interact with the API: - -[snip]:# (datastore-2) -```go -type Post struct { - Title string - Body string `datastore:",noindex"` - PublishedAt time.Time -} -keys := []*datastore.Key{ - datastore.NameKey("Post", "post1", nil), - datastore.NameKey("Post", "post2", nil), -} -posts := []*Post{ - {Title: "Post 1", Body: "...", PublishedAt: time.Now()}, - {Title: "Post 2", Body: "...", PublishedAt: time.Now()}, -} -if _, err := client.PutMulti(ctx, keys, posts); err != nil { - log.Fatal(err) -} -``` - -## Cloud Storage [![GoDoc](https://godoc.org/cloud.google.com/go/storage?status.svg)](https://godoc.org/cloud.google.com/go/storage) - -- [About Cloud Storage][cloud-storage] -- [API documentation][cloud-storage-docs] -- [Go client documentation](https://godoc.org/cloud.google.com/go/storage) -- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/storage) - -### Example Usage - -First create a `storage.Client` to use throughout your application: - -[snip]:# (storage-1) -```go -client, err := storage.NewClient(ctx) -if err != nil { - log.Fatal(err) -} -``` - -[snip]:# (storage-2) -```go -// Read the object1 from bucket. -rc, err := client.Bucket("bucket").Object("object1").NewReader(ctx) -if err != nil { - log.Fatal(err) -} -defer rc.Close() -body, err := ioutil.ReadAll(rc) -if err != nil { - log.Fatal(err) -} -``` - -## Cloud Pub/Sub [![GoDoc](https://godoc.org/cloud.google.com/go/pubsub?status.svg)](https://godoc.org/cloud.google.com/go/pubsub) - -- [About Cloud Pubsub][cloud-pubsub] -- [API documentation][cloud-pubsub-docs] -- [Go client documentation](https://godoc.org/cloud.google.com/go/pubsub) -- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/pubsub) - -### Example Usage - -First create a `pubsub.Client` to use throughout your application: - -[snip]:# (pubsub-1) -```go -client, err := pubsub.NewClient(ctx, "project-id") -if err != nil { - log.Fatal(err) -} -``` - -Then use the client to publish and subscribe: - -[snip]:# (pubsub-2) -```go -// Publish "hello world" on topic1. -topic := client.Topic("topic1") -res := topic.Publish(ctx, &pubsub.Message{ - Data: []byte("hello world"), -}) -// The publish happens asynchronously. -// Later, you can get the result from res: -... -msgID, err := res.Get(ctx) -if err != nil { - log.Fatal(err) -} - -// Use a callback to receive messages via subscription1. -sub := client.Subscription("subscription1") -err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { - fmt.Println(m.Data) - m.Ack() // Acknowledge that we've consumed the message. -}) -if err != nil { - log.Println(err) -} -``` - -## Cloud BigQuery [![GoDoc](https://godoc.org/cloud.google.com/go/bigquery?status.svg)](https://godoc.org/cloud.google.com/go/bigquery) - -- [About Cloud BigQuery][cloud-bigquery] -- [API documentation][cloud-bigquery-docs] -- [Go client documentation][cloud-bigquery-ref] -- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/bigquery) - -### Example Usage - -First create a `bigquery.Client` to use throughout your application: -[snip]:# (bq-1) -```go -c, err := bigquery.NewClient(ctx, "my-project-ID") -if err != nil { - // TODO: Handle error. -} -``` - -Then use that client to interact with the API: -[snip]:# (bq-2) -```go -// Construct a query. -q := c.Query(` - SELECT year, SUM(number) - FROM [bigquery-public-data:usa_names.usa_1910_2013] - WHERE name = "William" - GROUP BY year - ORDER BY year -`) -// Execute the query. -it, err := q.Read(ctx) -if err != nil { - // TODO: Handle error. -} -// Iterate through the results. -for { - var values []bigquery.Value - err := it.Next(&values) - if err == iterator.Done { - break - } - if err != nil { - // TODO: Handle error. - } - fmt.Println(values) -} -``` - - -## Stackdriver Logging [![GoDoc](https://godoc.org/cloud.google.com/go/logging?status.svg)](https://godoc.org/cloud.google.com/go/logging) - -- [About Stackdriver Logging][cloud-logging] -- [API documentation][cloud-logging-docs] -- [Go client documentation][cloud-logging-ref] -- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/logging) - -### Example Usage - -First create a `logging.Client` to use throughout your application: -[snip]:# (logging-1) -```go -ctx := context.Background() -client, err := logging.NewClient(ctx, "my-project") -if err != nil { - // TODO: Handle error. -} -``` - -Usually, you'll want to add log entries to a buffer to be periodically flushed -(automatically and asynchronously) to the Stackdriver Logging service. -[snip]:# (logging-2) -```go -logger := client.Logger("my-log") -logger.Log(logging.Entry{Payload: "something happened!"}) -``` - -Close your client before your program exits, to flush any buffered log entries. -[snip]:# (logging-3) -```go -err = client.Close() -if err != nil { - // TODO: Handle error. -} -``` - -## Cloud Spanner [![GoDoc](https://godoc.org/cloud.google.com/go/spanner?status.svg)](https://godoc.org/cloud.google.com/go/spanner) - -- [About Cloud Spanner][cloud-spanner] -- [API documentation][cloud-spanner-docs] -- [Go client documentation](https://godoc.org/cloud.google.com/go/spanner) - -### Example Usage - -First create a `spanner.Client` to use throughout your application: - -[snip]:# (spanner-1) -```go -client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D") -if err != nil { - log.Fatal(err) -} -``` - -[snip]:# (spanner-2) -```go -// Simple Reads And Writes -_, err = client.Apply(ctx, []*spanner.Mutation{ - spanner.Insert("Users", - []string{"name", "email"}, - []interface{}{"alice", "a@example.com"})}) -if err != nil { - log.Fatal(err) -} -row, err := client.Single().ReadRow(ctx, "Users", - spanner.Key{"alice"}, []string{"email"}) -if err != nil { - log.Fatal(err) -} -``` - - -## Contributing - -Contributions are welcome. Please, see the -[CONTRIBUTING](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md) -document for details. We're using Gerrit for our code reviews. Please don't open pull -requests against this repo, new pull requests will be automatically closed. - -Please note that this project is released with a Contributor Code of Conduct. -By participating in this project you agree to abide by its terms. -See [Contributor Code of Conduct](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md#contributor-code-of-conduct) -for more information. - -[cloud-datastore]: https://cloud.google.com/datastore/ -[cloud-datastore-ref]: https://godoc.org/cloud.google.com/go/datastore -[cloud-datastore-docs]: https://cloud.google.com/datastore/docs -[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate - -[cloud-firestore]: https://cloud.google.com/firestore/ -[cloud-firestore-ref]: https://godoc.org/cloud.google.com/go/firestore -[cloud-firestore-docs]: https://cloud.google.com/firestore/docs -[cloud-firestore-activation]: https://cloud.google.com/firestore/docs/activate - -[cloud-pubsub]: https://cloud.google.com/pubsub/ -[cloud-pubsub-ref]: https://godoc.org/cloud.google.com/go/pubsub -[cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs - -[cloud-storage]: https://cloud.google.com/storage/ -[cloud-storage-ref]: https://godoc.org/cloud.google.com/go/storage -[cloud-storage-docs]: https://cloud.google.com/storage/docs -[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets - -[cloud-bigtable]: https://cloud.google.com/bigtable/ -[cloud-bigtable-ref]: https://godoc.org/cloud.google.com/go/bigtable - -[cloud-bigquery]: https://cloud.google.com/bigquery/ -[cloud-bigquery-docs]: https://cloud.google.com/bigquery/docs -[cloud-bigquery-ref]: https://godoc.org/cloud.google.com/go/bigquery - -[cloud-logging]: https://cloud.google.com/logging/ -[cloud-logging-docs]: https://cloud.google.com/logging/docs -[cloud-logging-ref]: https://godoc.org/cloud.google.com/go/logging - -[cloud-monitoring]: https://cloud.google.com/monitoring/ -[cloud-monitoring-ref]: https://godoc.org/cloud.google.com/go/monitoring/apiv3 - -[cloud-vision]: https://cloud.google.com/vision -[cloud-vision-ref]: https://godoc.org/cloud.google.com/go/vision/apiv1 - -[cloud-language]: https://cloud.google.com/natural-language -[cloud-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1 - -[cloud-speech]: https://cloud.google.com/speech -[cloud-speech-ref]: https://godoc.org/cloud.google.com/go/speech/apiv1 - -[cloud-spanner]: https://cloud.google.com/spanner/ -[cloud-spanner-ref]: https://godoc.org/cloud.google.com/go/spanner -[cloud-spanner-docs]: https://cloud.google.com/spanner/docs - -[cloud-translation]: https://cloud.google.com/translation -[cloud-translation-ref]: https://godoc.org/cloud.google.com/go/translation - -[cloud-trace]: https://cloud.google.com/trace/ -[cloud-trace-ref]: https://godoc.org/cloud.google.com/go/trace - -[cloud-video]: https://cloud.google.com/video-intelligence/ -[cloud-video-ref]: https://godoc.org/cloud.google.com/go/videointelligence/apiv1beta1 - -[cloud-errors]: https://cloud.google.com/error-reporting/ -[cloud-errors-ref]: https://godoc.org/cloud.google.com/go/errorreporting - -[default-creds]: https://developers.google.com/identity/protocols/application-default-credentials diff --git a/vendor/cloud.google.com/go/appveyor.yml b/vendor/cloud.google.com/go/appveyor.yml deleted file mode 100644 index e66cd00a..00000000 --- a/vendor/cloud.google.com/go/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This file configures AppVeyor (http://www.appveyor.com), -# a Windows-based CI service similar to Travis. - -# Identifier for this run -version: "{build}" - -# Clone the repo into this path, which conforms to the standard -# Go workspace structure. -clone_folder: c:\gopath\src\cloud.google.com\go - -environment: - GOPATH: c:\gopath - GCLOUD_TESTS_GOLANG_PROJECT_ID: dulcet-port-762 - GCLOUD_TESTS_GOLANG_KEY: c:\gopath\src\cloud.google.com\go\key.json - KEYFILE_CONTENTS: - secure: IvRbDAhM2PIQqzVkjzJ4FjizUvoQ+c3vG/qhJQG+HlZ/L5KEkqLu+x6WjLrExrNMyGku4znB2jmbTrUW3Ob4sGG+R5vvqeQ3YMHCVIkw5CxY+/bUDkW5RZWsVbuCnNa/vKsWmCP+/sZW6ICe29yKJ2ZOb6QaauI4s9R6j+cqBbU9pumMGYFRb0Rw3uUU7DKmVFCy+NjTENZIlDP9rmjANgAzigowJJEb2Tg9sLlQKmQeKiBSRN8lKc5Nq60a+fIzHGKvql4eIitDDDpOpyHv15/Xr1BzFw2yDoiR4X1lng0u7q0X9RgX4VIYa6gT16NXBEmQgbuX8gh7SfPMp9RhiZD9sVUaV+yogEabYpyPnmUURo0hXwkctKaBkQlEmKvjHwF5dvbg8+yqGhwtjAgFNimXG3INrwQsfQsZskkQWanutbJf9xy50GyWWFZZdi0uT4oXP/b5P7aklPXKXsvrJKBh7RjEaqBrhi86IJwOjBspvoR4l2WmcQyxb2xzQS1pjbBJFQfYJJ8+JgsstTL8PBO9d4ybJC0li1Om1qnWxkaewvPxxuoHJ9LpRKof19yRYWBmhTXb2tTASKG/zslvl4fgG4DmQBS93WC7dsiGOhAraGw2eCTgd0lYZOhk1FjWl9TS80aktXxzH/7nTvem5ohm+eDl6O0wnTL4KXjQVNSQ1PyLn4lGRJ5MNGzBTRFWIr2API2rca4Fysyfh/UdmazPGlNbY9JPGqb9+F04QzLfqm+Zz/cHy59E7lOSMBlUI4KD6d6ZNNKNRH+/g9i+fSiyiXKugTfda8KBnWGyPwprxuWGYaiQUGUYOwJY5R6x5c4mjImAB310V+Wo33UbWFJiwxEDsiCNqW1meVkBzt2er26vh4qbgCUIQ3iM3gFPfHgy+QxkmIhic7Q1HYacQElt8AAP41M7cCKWCuZidegP37MBB//mjjiNt047ZSQEvB4tqsX/OvfbByVef+cbtVw9T0yjHvmCdPW1XrhyrCCgclu6oYYdbmc5D7BBDRbjjMWGv6YvceAbfGf6ukdB5PuV+TGEN/FoQ1QTRA6Aqf+3fLMg4mS4oyTfw5xyYNbv3qoyLPrp+BnxI53WB9p0hfMg4n9FD6NntBxjDq+Q3Lk/bjC/Y4MaRWdzbMzF9a0lgGfcw9DURlK5p7uGJC9vg34feNoQprxVEZRQ01cHLeob6eGkYm4HxSRx8JY39Mh+9wzJo+k/aIvFleNC3e35NOrkXr6wb5e42n2DwBdPqdNolTLtLFRglAL1LTpp27UjvjieWJAKfoDTR5CKl01sZqt0wPdLLcvsMj6CiPFmccUIOYeZMe86kLBD61Qa5F1EwkgO3Om2qSjW96FzL4skRc+BmU5RrHlAFSldR1wpUgtkUMv9vH5Cy+UJdcvpZ8KbmhZ2PsjF7ddJ1ve9RAw3cP325AyIMwZ77Ef1mgTM0NJze6eSW1qKlEsgt1FADPyeUu1NQTA2H2dueMPGlArWTSUgyWR9AdfpqouT7eg0JWI5w+yUZZC+/rPglYbt84oLmYpwuli0z8FyEQRPIc3EtkfWIv/yYgDr2TZ0N2KvGfpi/MAUWgxI1gleC2uKgEOEtuJthd3XZjF2NoE7IBqjQOINybcJOjyeB5vRLDY1FLuxYzdg1y1etkV4XQig/vje - -install: - # Info for debugging. - - echo %PATH% - - go version - - go env - - go get -v -d -t ./... - - -# Provide a build script, or AppVeyor will call msbuild. -build_script: - - go install -v ./... - - echo %KEYFILE_CONTENTS% > %GCLOUD_TESTS_GOLANG_KEY% - -test_script: - - go test -v ./... diff --git a/vendor/cloud.google.com/go/authexample_test.go b/vendor/cloud.google.com/go/authexample_test.go deleted file mode 100644 index fe75467f..00000000 --- a/vendor/cloud.google.com/go/authexample_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package cloud_test - -import ( - "cloud.google.com/go/datastore" - "golang.org/x/net/context" - "google.golang.org/api/option" -) - -func Example_applicationDefaultCredentials() { - // Google Application Default Credentials is the recommended way to authorize - // and authenticate clients. - // - // See the following link on how to create and obtain Application Default Credentials: - // https://developers.google.com/identity/protocols/application-default-credentials. - client, err := datastore.NewClient(context.Background(), "project-id") - if err != nil { - // TODO: handle error. - } - _ = client // Use the client. -} - -func Example_serviceAccountFile() { - // Use a JSON key file associated with a Google service account to - // authenticate and authorize. Service Account keys can be created and - // downloaded from https://console.developers.google.com/permissions/serviceaccounts. - // - // Note: This example uses the datastore client, but the same steps apply to - // the other client libraries underneath this package. - client, err := datastore.NewClient(context.Background(), - "project-id", option.WithServiceAccountFile("/path/to/service-account-key.json")) - if err != nil { - // TODO: handle error. - } - _ = client // Use the client. -} diff --git a/vendor/cloud.google.com/go/cloud.go b/vendor/cloud.google.com/go/cloud.go deleted file mode 100644 index 6ba428dc..00000000 --- a/vendor/cloud.google.com/go/cloud.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package cloud is the root of the packages used to access Google Cloud -// Services. See https://godoc.org/cloud.google.com/go for a full list -// of sub-packages. -// -// This package documents how to authorize and authenticate the sub packages. -package cloud // import "cloud.google.com/go" diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go deleted file mode 100644 index e708c031..00000000 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright 2014 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package metadata provides access to Google Compute Engine (GCE) -// metadata and API service accounts. -// -// This package is a wrapper around the GCE metadata service, -// as documented at https://developers.google.com/compute/docs/metadata. -package metadata // import "cloud.google.com/go/compute/metadata" - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net" - "net/http" - "net/url" - "os" - "runtime" - "strings" - "sync" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/context/ctxhttp" -) - -const ( - // metadataIP is the documented metadata server IP address. - metadataIP = "169.254.169.254" - - // metadataHostEnv is the environment variable specifying the - // GCE metadata hostname. If empty, the default value of - // metadataIP ("169.254.169.254") is used instead. - // This is variable name is not defined by any spec, as far as - // I know; it was made up for the Go package. - metadataHostEnv = "GCE_METADATA_HOST" - - userAgent = "gcloud-golang/0.1" -) - -type cachedValue struct { - k string - trim bool - mu sync.Mutex - v string -} - -var ( - projID = &cachedValue{k: "project/project-id", trim: true} - projNum = &cachedValue{k: "project/numeric-project-id", trim: true} - instID = &cachedValue{k: "instance/id", trim: true} -) - -var ( - metaClient = &http.Client{ - Transport: &http.Transport{ - Dial: (&net.Dialer{ - Timeout: 2 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - ResponseHeaderTimeout: 2 * time.Second, - }, - } - subscribeClient = &http.Client{ - Transport: &http.Transport{ - Dial: (&net.Dialer{ - Timeout: 2 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - }, - } -) - -// NotDefinedError is returned when requested metadata is not defined. -// -// The underlying string is the suffix after "/computeMetadata/v1/". -// -// This error is not returned if the value is defined to be the empty -// string. -type NotDefinedError string - -func (suffix NotDefinedError) Error() string { - return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix)) -} - -// Get returns a value from the metadata service. -// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". -// -// If the GCE_METADATA_HOST environment variable is not defined, a default of -// 169.254.169.254 will be used instead. -// -// If the requested metadata is not defined, the returned error will -// be of type NotDefinedError. -func Get(suffix string) (string, error) { - val, _, err := getETag(metaClient, suffix) - return val, err -} - -// getETag returns a value from the metadata service as well as the associated -// ETag using the provided client. This func is otherwise equivalent to Get. -func getETag(client *http.Client, suffix string) (value, etag string, err error) { - // Using a fixed IP makes it very difficult to spoof the metadata service in - // a container, which is an important use-case for local testing of cloud - // deployments. To enable spoofing of the metadata service, the environment - // variable GCE_METADATA_HOST is first inspected to decide where metadata - // requests shall go. - host := os.Getenv(metadataHostEnv) - if host == "" { - // Using 169.254.169.254 instead of "metadata" here because Go - // binaries built with the "netgo" tag and without cgo won't - // know the search suffix for "metadata" is - // ".google.internal", and this IP address is documented as - // being stable anyway. - host = metadataIP - } - url := "http://" + host + "/computeMetadata/v1/" + suffix - req, _ := http.NewRequest("GET", url, nil) - req.Header.Set("Metadata-Flavor", "Google") - req.Header.Set("User-Agent", userAgent) - res, err := client.Do(req) - if err != nil { - return "", "", err - } - defer res.Body.Close() - if res.StatusCode == http.StatusNotFound { - return "", "", NotDefinedError(suffix) - } - if res.StatusCode != 200 { - return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url) - } - all, err := ioutil.ReadAll(res.Body) - if err != nil { - return "", "", err - } - return string(all), res.Header.Get("Etag"), nil -} - -func getTrimmed(suffix string) (s string, err error) { - s, err = Get(suffix) - s = strings.TrimSpace(s) - return -} - -func (c *cachedValue) get() (v string, err error) { - defer c.mu.Unlock() - c.mu.Lock() - if c.v != "" { - return c.v, nil - } - if c.trim { - v, err = getTrimmed(c.k) - } else { - v, err = Get(c.k) - } - if err == nil { - c.v = v - } - return -} - -var ( - onGCEOnce sync.Once - onGCE bool -) - -// OnGCE reports whether this process is running on Google Compute Engine. -func OnGCE() bool { - onGCEOnce.Do(initOnGCE) - return onGCE -} - -func initOnGCE() { - onGCE = testOnGCE() -} - -func testOnGCE() bool { - // The user explicitly said they're on GCE, so trust them. - if os.Getenv(metadataHostEnv) != "" { - return true - } - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - resc := make(chan bool, 2) - - // Try two strategies in parallel. - // See https://github.com/GoogleCloudPlatform/google-cloud-go/issues/194 - go func() { - req, _ := http.NewRequest("GET", "http://"+metadataIP, nil) - req.Header.Set("User-Agent", userAgent) - res, err := ctxhttp.Do(ctx, metaClient, req) - if err != nil { - resc <- false - return - } - defer res.Body.Close() - resc <- res.Header.Get("Metadata-Flavor") == "Google" - }() - - go func() { - addrs, err := net.LookupHost("metadata.google.internal") - if err != nil || len(addrs) == 0 { - resc <- false - return - } - resc <- strsContains(addrs, metadataIP) - }() - - tryHarder := systemInfoSuggestsGCE() - if tryHarder { - res := <-resc - if res { - // The first strategy succeeded, so let's use it. - return true - } - // Wait for either the DNS or metadata server probe to - // contradict the other one and say we are running on - // GCE. Give it a lot of time to do so, since the system - // info already suggests we're running on a GCE BIOS. - timer := time.NewTimer(5 * time.Second) - defer timer.Stop() - select { - case res = <-resc: - return res - case <-timer.C: - // Too slow. Who knows what this system is. - return false - } - } - - // There's no hint from the system info that we're running on - // GCE, so use the first probe's result as truth, whether it's - // true or false. The goal here is to optimize for speed for - // users who are NOT running on GCE. We can't assume that - // either a DNS lookup or an HTTP request to a blackholed IP - // address is fast. Worst case this should return when the - // metaClient's Transport.ResponseHeaderTimeout or - // Transport.Dial.Timeout fires (in two seconds). - return <-resc -} - -// systemInfoSuggestsGCE reports whether the local system (without -// doing network requests) suggests that we're running on GCE. If this -// returns true, testOnGCE tries a bit harder to reach its metadata -// server. -func systemInfoSuggestsGCE() bool { - if runtime.GOOS != "linux" { - // We don't have any non-Linux clues available, at least yet. - return false - } - slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name") - name := strings.TrimSpace(string(slurp)) - return name == "Google" || name == "Google Compute Engine" -} - -// Subscribe subscribes to a value from the metadata service. -// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". -// The suffix may contain query parameters. -// -// Subscribe calls fn with the latest metadata value indicated by the provided -// suffix. If the metadata value is deleted, fn is called with the empty string -// and ok false. Subscribe blocks until fn returns a non-nil error or the value -// is deleted. Subscribe returns the error value returned from the last call to -// fn, which may be nil when ok == false. -func Subscribe(suffix string, fn func(v string, ok bool) error) error { - const failedSubscribeSleep = time.Second * 5 - - // First check to see if the metadata value exists at all. - val, lastETag, err := getETag(subscribeClient, suffix) - if err != nil { - return err - } - - if err := fn(val, true); err != nil { - return err - } - - ok := true - if strings.ContainsRune(suffix, '?') { - suffix += "&wait_for_change=true&last_etag=" - } else { - suffix += "?wait_for_change=true&last_etag=" - } - for { - val, etag, err := getETag(subscribeClient, suffix+url.QueryEscape(lastETag)) - if err != nil { - if _, deleted := err.(NotDefinedError); !deleted { - time.Sleep(failedSubscribeSleep) - continue // Retry on other errors. - } - ok = false - } - lastETag = etag - - if err := fn(val, ok); err != nil || !ok { - return err - } - } -} - -// ProjectID returns the current instance's project ID string. -func ProjectID() (string, error) { return projID.get() } - -// NumericProjectID returns the current instance's numeric project ID. -func NumericProjectID() (string, error) { return projNum.get() } - -// InternalIP returns the instance's primary internal IP address. -func InternalIP() (string, error) { - return getTrimmed("instance/network-interfaces/0/ip") -} - -// ExternalIP returns the instance's primary external (public) IP address. -func ExternalIP() (string, error) { - return getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip") -} - -// Hostname returns the instance's hostname. This will be of the form -// ".c..internal". -func Hostname() (string, error) { - return getTrimmed("instance/hostname") -} - -// InstanceTags returns the list of user-defined instance tags, -// assigned when initially creating a GCE instance. -func InstanceTags() ([]string, error) { - var s []string - j, err := Get("instance/tags") - if err != nil { - return nil, err - } - if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil { - return nil, err - } - return s, nil -} - -// InstanceID returns the current VM's numeric instance ID. -func InstanceID() (string, error) { - return instID.get() -} - -// InstanceName returns the current VM's instance ID string. -func InstanceName() (string, error) { - host, err := Hostname() - if err != nil { - return "", err - } - return strings.Split(host, ".")[0], nil -} - -// Zone returns the current VM's zone, such as "us-central1-b". -func Zone() (string, error) { - zone, err := getTrimmed("instance/zone") - // zone is of the form "projects//zones/". - if err != nil { - return "", err - } - return zone[strings.LastIndex(zone, "/")+1:], nil -} - -// InstanceAttributes returns the list of user-defined attributes, -// assigned when initially creating a GCE VM instance. The value of an -// attribute can be obtained with InstanceAttributeValue. -func InstanceAttributes() ([]string, error) { return lines("instance/attributes/") } - -// ProjectAttributes returns the list of user-defined attributes -// applying to the project as a whole, not just this VM. The value of -// an attribute can be obtained with ProjectAttributeValue. -func ProjectAttributes() ([]string, error) { return lines("project/attributes/") } - -func lines(suffix string) ([]string, error) { - j, err := Get(suffix) - if err != nil { - return nil, err - } - s := strings.Split(strings.TrimSpace(j), "\n") - for i := range s { - s[i] = strings.TrimSpace(s[i]) - } - return s, nil -} - -// InstanceAttributeValue returns the value of the provided VM -// instance attribute. -// -// If the requested attribute is not defined, the returned error will -// be of type NotDefinedError. -// -// InstanceAttributeValue may return ("", nil) if the attribute was -// defined to be the empty string. -func InstanceAttributeValue(attr string) (string, error) { - return Get("instance/attributes/" + attr) -} - -// ProjectAttributeValue returns the value of the provided -// project attribute. -// -// If the requested attribute is not defined, the returned error will -// be of type NotDefinedError. -// -// ProjectAttributeValue may return ("", nil) if the attribute was -// defined to be the empty string. -func ProjectAttributeValue(attr string) (string, error) { - return Get("project/attributes/" + attr) -} - -// Scopes returns the service account scopes for the given account. -// The account may be empty or the string "default" to use the instance's -// main account. -func Scopes(serviceAccount string) ([]string, error) { - if serviceAccount == "" { - serviceAccount = "default" - } - return lines("instance/service-accounts/" + serviceAccount + "/scopes") -} - -func strsContains(ss []string, s string) bool { - for _, v := range ss { - if v == s { - return true - } - } - return false -} diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata_test.go b/vendor/cloud.google.com/go/compute/metadata/metadata_test.go deleted file mode 100644 index 9ac59269..00000000 --- a/vendor/cloud.google.com/go/compute/metadata/metadata_test.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metadata - -import ( - "os" - "sync" - "testing" -) - -func TestOnGCE_Stress(t *testing.T) { - if testing.Short() { - t.Skip("skipping in -short mode") - } - var last bool - for i := 0; i < 100; i++ { - onGCEOnce = sync.Once{} - - now := OnGCE() - if i > 0 && now != last { - t.Errorf("%d. changed from %v to %v", i, last, now) - } - last = now - } - t.Logf("OnGCE() = %v", last) -} - -func TestOnGCE_Force(t *testing.T) { - onGCEOnce = sync.Once{} - old := os.Getenv(metadataHostEnv) - defer os.Setenv(metadataHostEnv, old) - os.Setenv(metadataHostEnv, "127.0.0.1") - if !OnGCE() { - t.Error("OnGCE() = false; want true") - } -} diff --git a/vendor/cloud.google.com/go/key.json.enc b/vendor/cloud.google.com/go/key.json.enc deleted file mode 100644 index a8978a90..00000000 Binary files a/vendor/cloud.google.com/go/key.json.enc and /dev/null differ diff --git a/vendor/cloud.google.com/go/license_test.go b/vendor/cloud.google.com/go/license_test.go deleted file mode 100644 index 4b87878a..00000000 --- a/vendor/cloud.google.com/go/license_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package cloud - -import ( - "bytes" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" -) - -var sentinels = []string{ - "Copyright", - "Google Inc", - `Licensed under the Apache License, Version 2.0 (the "License");`, -} - -func TestLicense(t *testing.T) { - err := filepath.Walk(".", func(path string, fi os.FileInfo, err error) error { - if err != nil { - return err - } - - if ext := filepath.Ext(path); ext != ".go" && ext != ".proto" { - return nil - } - if strings.HasSuffix(path, ".pb.go") { - // .pb.go files are generated from the proto files. - // .proto files must have license headers. - return nil - } - if path == "bigtable/cmd/cbt/cbtdoc.go" { - // Automatically generated. - return nil - } - - src, err := ioutil.ReadFile(path) - if err != nil { - return nil - } - src = src[:140] // Ensure all of the sentinel values are at the top of the file. - - // Find license - for _, sentinel := range sentinels { - if !bytes.Contains(src, []byte(sentinel)) { - t.Errorf("%v: license header not present. want %q", path, sentinel) - return nil - } - } - - return nil - }) - if err != nil { - t.Fatal(err) - } -} diff --git a/vendor/cloud.google.com/go/old-news.md b/vendor/cloud.google.com/go/old-news.md deleted file mode 100644 index 896980d9..00000000 --- a/vendor/cloud.google.com/go/old-news.md +++ /dev/null @@ -1,486 +0,0 @@ -_July 31, 2017_ - -*v0.11.0* - -- Clients for spanner, pubsub and video are now in beta. - -- New client for DLP. - -- spanner: performance and testing improvements. - -- storage: requester-pays buckets are supported. - -- storage, profiler, bigtable, bigquery: bug fixes and other minor improvements. - -- pubsub: bug fixes and other minor improvements - -_June 17, 2017_ - - -*v0.10.0* - -- pubsub: Subscription.ModifyPushConfig replaced with Subscription.Update. - -- pubsub: Subscription.Receive now runs concurrently for higher throughput. - -- vision: cloud.google.com/go/vision is deprecated. Use -cloud.google.com/go/vision/apiv1 instead. - -- translation: now stable. - -- trace: several changes to the surface. See the link below. - -[Code changes required from v0.9.0.](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/MIGRATION.md) - - -_March 17, 2017_ - -Breaking Pubsub changes. -* Publish is now asynchronous -([announcement](https://groups.google.com/d/topic/google-api-go-announce/aaqRDIQ3rvU/discussion)). -* Subscription.Pull replaced by Subscription.Receive, which takes a callback ([announcement](https://groups.google.com/d/topic/google-api-go-announce/8pt6oetAdKc/discussion)). -* Message.Done replaced with Message.Ack and Message.Nack. - -_February 14, 2017_ - -Release of a client library for Spanner. See -the -[blog post](https://cloudplatform.googleblog.com/2017/02/introducing-Cloud-Spanner-a-global-database-service-for-mission-critical-applications.html). - -Note that although the Spanner service is beta, the Go client library is alpha. - -_December 12, 2016_ - -Beta release of BigQuery, DataStore, Logging and Storage. See the -[blog post](https://cloudplatform.googleblog.com/2016/12/announcing-new-google-cloud-client.html). - -Also, BigQuery now supports structs. Read a row directly into a struct with -`RowIterator.Next`, and upload a row directly from a struct with `Uploader.Put`. -You can also use field tags. See the [package documentation][cloud-bigquery-ref] -for details. - -_December 5, 2016_ - -More changes to BigQuery: - -* The `ValueList` type was removed. It is no longer necessary. Instead of - ```go - var v ValueList - ... it.Next(&v) .. - ``` - use - - ```go - var v []Value - ... it.Next(&v) ... - ``` - -* Previously, repeatedly calling `RowIterator.Next` on the same `[]Value` or - `ValueList` would append to the slice. Now each call resets the size to zero first. - -* Schema inference will infer the SQL type BYTES for a struct field of - type []byte. Previously it inferred STRING. - -* The types `uint`, `uint64` and `uintptr` are no longer supported in schema - inference. BigQuery's integer type is INT64, and those types may hold values - that are not correctly represented in a 64-bit signed integer. - -* The SQL types DATE, TIME and DATETIME are now supported. They correspond to - the `Date`, `Time` and `DateTime` types in the new `cloud.google.com/go/civil` - package. - -_November 17, 2016_ - -Change to BigQuery: values from INTEGER columns will now be returned as int64, -not int. This will avoid errors arising from large values on 32-bit systems. - -_November 8, 2016_ - -New datastore feature: datastore now encodes your nested Go structs as Entity values, -instead of a flattened list of the embedded struct's fields. -This means that you may now have twice-nested slices, eg. -```go -type State struct { - Cities []struct{ - Populations []int - } -} -``` - -See [the announcement](https://groups.google.com/forum/#!topic/google-api-go-announce/79jtrdeuJAg) for -more details. - -_November 8, 2016_ - -Breaking changes to datastore: contexts no longer hold namespaces; instead you -must set a key's namespace explicitly. Also, key functions have been changed -and renamed. - -* The WithNamespace function has been removed. To specify a namespace in a Query, use the Query.Namespace method: - ```go - q := datastore.NewQuery("Kind").Namespace("ns") - ``` - -* All the fields of Key are exported. That means you can construct any Key with a struct literal: - ```go - k := &Key{Kind: "Kind", ID: 37, Namespace: "ns"} - ``` - -* As a result of the above, the Key methods Kind, ID, d.Name, Parent, SetParent and Namespace have been removed. - -* `NewIncompleteKey` has been removed, replaced by `IncompleteKey`. Replace - ```go - NewIncompleteKey(ctx, kind, parent) - ``` - with - ```go - IncompleteKey(kind, parent) - ``` - and if you do use namespaces, make sure you set the namespace on the returned key. - -* `NewKey` has been removed, replaced by `NameKey` and `IDKey`. Replace - ```go - NewKey(ctx, kind, name, 0, parent) - NewKey(ctx, kind, "", id, parent) - ``` - with - ```go - NameKey(kind, name, parent) - IDKey(kind, id, parent) - ``` - and if you do use namespaces, make sure you set the namespace on the returned key. - -* The `Done` variable has been removed. Replace `datastore.Done` with `iterator.Done`, from the package `google.golang.org/api/iterator`. - -* The `Client.Close` method will have a return type of error. It will return the result of closing the underlying gRPC connection. - -See [the announcement](https://groups.google.com/forum/#!topic/google-api-go-announce/hqXtM_4Ix-0) for -more details. - -_October 27, 2016_ - -Breaking change to bigquery: `NewGCSReference` is now a function, -not a method on `Client`. - -New bigquery feature: `Table.LoaderFrom` now accepts a `ReaderSource`, enabling -loading data into a table from a file or any `io.Reader`. - -_October 21, 2016_ - -Breaking change to pubsub: removed `pubsub.Done`. - -Use `iterator.Done` instead, where `iterator` is the package -`google.golang.org/api/iterator`. - -_October 19, 2016_ - -Breaking changes to cloud.google.com/go/bigquery: - -* Client.Table and Client.OpenTable have been removed. - Replace - ```go - client.OpenTable("project", "dataset", "table") - ``` - with - ```go - client.DatasetInProject("project", "dataset").Table("table") - ``` - -* Client.CreateTable has been removed. - Replace - ```go - client.CreateTable(ctx, "project", "dataset", "table") - ``` - with - ```go - client.DatasetInProject("project", "dataset").Table("table").Create(ctx) - ``` - -* Dataset.ListTables have been replaced with Dataset.Tables. - Replace - ```go - tables, err := ds.ListTables(ctx) - ``` - with - ```go - it := ds.Tables(ctx) - for { - table, err := it.Next() - if err == iterator.Done { - break - } - if err != nil { - // TODO: Handle error. - } - // TODO: use table. - } - ``` - -* Client.Read has been replaced with Job.Read, Table.Read and Query.Read. - Replace - ```go - it, err := client.Read(ctx, job) - ``` - with - ```go - it, err := job.Read(ctx) - ``` - and similarly for reading from tables or queries. - -* The iterator returned from the Read methods is now named RowIterator. Its - behavior is closer to the other iterators in these libraries. It no longer - supports the Schema method; see the next item. - Replace - ```go - for it.Next(ctx) { - var vals ValueList - if err := it.Get(&vals); err != nil { - // TODO: Handle error. - } - // TODO: use vals. - } - if err := it.Err(); err != nil { - // TODO: Handle error. - } - ``` - with - ``` - for { - var vals ValueList - err := it.Next(&vals) - if err == iterator.Done { - break - } - if err != nil { - // TODO: Handle error. - } - // TODO: use vals. - } - ``` - Instead of the `RecordsPerRequest(n)` option, write - ```go - it.PageInfo().MaxSize = n - ``` - Instead of the `StartIndex(i)` option, write - ```go - it.StartIndex = i - ``` - -* ValueLoader.Load now takes a Schema in addition to a slice of Values. - Replace - ```go - func (vl *myValueLoader) Load(v []bigquery.Value) - ``` - with - ```go - func (vl *myValueLoader) Load(v []bigquery.Value, s bigquery.Schema) - ``` - - -* Table.Patch is replace by Table.Update. - Replace - ```go - p := table.Patch() - p.Description("new description") - metadata, err := p.Apply(ctx) - ``` - with - ```go - metadata, err := table.Update(ctx, bigquery.TableMetadataToUpdate{ - Description: "new description", - }) - ``` - -* Client.Copy is replaced by separate methods for each of its four functions. - All options have been replaced by struct fields. - - * To load data from Google Cloud Storage into a table, use Table.LoaderFrom. - - Replace - ```go - client.Copy(ctx, table, gcsRef) - ``` - with - ```go - table.LoaderFrom(gcsRef).Run(ctx) - ``` - Instead of passing options to Copy, set fields on the Loader: - ```go - loader := table.LoaderFrom(gcsRef) - loader.WriteDisposition = bigquery.WriteTruncate - ``` - - * To extract data from a table into Google Cloud Storage, use - Table.ExtractorTo. Set fields on the returned Extractor instead of - passing options. - - Replace - ```go - client.Copy(ctx, gcsRef, table) - ``` - with - ```go - table.ExtractorTo(gcsRef).Run(ctx) - ``` - - * To copy data into a table from one or more other tables, use - Table.CopierFrom. Set fields on the returned Copier instead of passing options. - - Replace - ```go - client.Copy(ctx, dstTable, srcTable) - ``` - with - ```go - dst.Table.CopierFrom(srcTable).Run(ctx) - ``` - - * To start a query job, create a Query and call its Run method. Set fields - on the query instead of passing options. - - Replace - ```go - client.Copy(ctx, table, query) - ``` - with - ```go - query.Run(ctx) - ``` - -* Table.NewUploader has been renamed to Table.Uploader. Instead of options, - configure an Uploader by setting its fields. - Replace - ```go - u := table.NewUploader(bigquery.UploadIgnoreUnknownValues()) - ``` - with - ```go - u := table.NewUploader(bigquery.UploadIgnoreUnknownValues()) - u.IgnoreUnknownValues = true - ``` - -_October 10, 2016_ - -Breaking changes to cloud.google.com/go/storage: - -* AdminClient replaced by methods on Client. - Replace - ```go - adminClient.CreateBucket(ctx, bucketName, attrs) - ``` - with - ```go - client.Bucket(bucketName).Create(ctx, projectID, attrs) - ``` - -* BucketHandle.List replaced by BucketHandle.Objects. - Replace - ```go - for query != nil { - objs, err := bucket.List(d.ctx, query) - if err != nil { ... } - query = objs.Next - for _, obj := range objs.Results { - fmt.Println(obj) - } - } - ``` - with - ```go - iter := bucket.Objects(d.ctx, query) - for { - obj, err := iter.Next() - if err == iterator.Done { - break - } - if err != nil { ... } - fmt.Println(obj) - } - ``` - (The `iterator` package is at `google.golang.org/api/iterator`.) - - Replace `Query.Cursor` with `ObjectIterator.PageInfo().Token`. - - Replace `Query.MaxResults` with `ObjectIterator.PageInfo().MaxSize`. - - -* ObjectHandle.CopyTo replaced by ObjectHandle.CopierFrom. - Replace - ```go - attrs, err := src.CopyTo(ctx, dst, nil) - ``` - with - ```go - attrs, err := dst.CopierFrom(src).Run(ctx) - ``` - - Replace - ```go - attrs, err := src.CopyTo(ctx, dst, &storage.ObjectAttrs{ContextType: "text/html"}) - ``` - with - ```go - c := dst.CopierFrom(src) - c.ContextType = "text/html" - attrs, err := c.Run(ctx) - ``` - -* ObjectHandle.ComposeFrom replaced by ObjectHandle.ComposerFrom. - Replace - ```go - attrs, err := dst.ComposeFrom(ctx, []*storage.ObjectHandle{src1, src2}, nil) - ``` - with - ```go - attrs, err := dst.ComposerFrom(src1, src2).Run(ctx) - ``` - -* ObjectHandle.Update's ObjectAttrs argument replaced by ObjectAttrsToUpdate. - Replace - ```go - attrs, err := obj.Update(ctx, &storage.ObjectAttrs{ContextType: "text/html"}) - ``` - with - ```go - attrs, err := obj.Update(ctx, storage.ObjectAttrsToUpdate{ContextType: "text/html"}) - ``` - -* ObjectHandle.WithConditions replaced by ObjectHandle.If. - Replace - ```go - obj.WithConditions(storage.Generation(gen), storage.IfMetaGenerationMatch(mgen)) - ``` - with - ```go - obj.Generation(gen).If(storage.Conditions{MetagenerationMatch: mgen}) - ``` - - Replace - ```go - obj.WithConditions(storage.IfGenerationMatch(0)) - ``` - with - ```go - obj.If(storage.Conditions{DoesNotExist: true}) - ``` - -* `storage.Done` replaced by `iterator.Done` (from package `google.golang.org/api/iterator`). - -_October 6, 2016_ - -Package preview/logging deleted. Use logging instead. - -_September 27, 2016_ - -Logging client replaced with preview version (see below). - -_September 8, 2016_ - -* New clients for some of Google's Machine Learning APIs: Vision, Speech, and -Natural Language. - -* Preview version of a new [Stackdriver Logging][cloud-logging] client in -[`cloud.google.com/go/preview/logging`](https://godoc.org/cloud.google.com/go/preview/logging). -This client uses gRPC as its transport layer, and supports log reading, sinks -and metrics. It will replace the current client at `cloud.google.com/go/logging` shortly. - diff --git a/vendor/cloud.google.com/go/run-tests.sh b/vendor/cloud.google.com/go/run-tests.sh deleted file mode 100755 index f47ff50a..00000000 --- a/vendor/cloud.google.com/go/run-tests.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -# Selectively run tests for this repo, based on what has changed -# in a commit. Runs short tests for the whole repo, and full tests -# for changed directories. - -set -e - -prefix=cloud.google.com/go - -dryrun=false -if [[ $1 == "-n" ]]; then - dryrun=true - shift -fi - -if [[ $1 == "" ]]; then - echo >&2 "usage: $0 [-n] COMMIT" - exit 1 -fi - -# Files or directories that cause all tests to run if modified. -declare -A run_all -run_all=([.travis.yml]=1 [run-tests.sh]=1) - -function run { - if $dryrun; then - echo $* - else - (set -x; $*) - fi -} - - -# Find all the packages that have changed in this commit. -declare -A changed_packages - -for f in $(git diff-tree --no-commit-id --name-only -r $1); do - if [[ ${run_all[$f]} == 1 ]]; then - # This change requires a full test. Do it and exit. - run go test -race -v $prefix/... - exit - fi - # Map, e.g., "spanner/client.go" to "$prefix/spanner". - d=$(dirname $f) - if [[ $d == "." ]]; then - pkg=$prefix - else - pkg=$prefix/$d - fi - changed_packages[$pkg]=1 -done - -echo "changed packages: ${!changed_packages[*]}" - - -# Reports whether its argument, a package name, depends (recursively) -# on a changed package. -function depends_on_changed_package { - # According to go list, a package does not depend on itself, so - # we test that separately. - if [[ ${changed_packages[$1]} == 1 ]]; then - return 0 - fi - for dep in $(go list -f '{{range .Deps}}{{.}} {{end}}' $1); do - if [[ ${changed_packages[$dep]} == 1 ]]; then - return 0 - fi - done - return 1 -} - -# Collect the packages into two separate lists. (It is faster go test a list of -# packages than to individually go test each one.) - -shorts= -fulls= -for pkg in $(go list $prefix/...); do # for each package in the repo - if depends_on_changed_package $pkg; then # if it depends on a changed package - fulls="$fulls $pkg" # run the full test - else # otherwise - shorts="$shorts $pkg" # run the short test - fi -done -run go test -race -v -short $shorts -if [[ $fulls != "" ]]; then - run go test -race -v $fulls -fi diff --git a/vendor/github.com/Gurpartap/logrus-stack/License b/vendor/github.com/Gurpartap/logrus-stack/License deleted file mode 100644 index 6e3f4fe1..00000000 --- a/vendor/github.com/Gurpartap/logrus-stack/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016 Gurpartap Singh - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/Gurpartap/logrus-stack/Readme.md b/vendor/github.com/Gurpartap/logrus-stack/Readme.md deleted file mode 100644 index ec758278..00000000 --- a/vendor/github.com/Gurpartap/logrus-stack/Readme.md +++ /dev/null @@ -1,144 +0,0 @@ -# logrus-stack 🎯 -[![GoDoc](https://godoc.org/github.com/Gurpartap/logrus-stack?status.svg)](https://godoc.org/github.com/Gurpartap/logrus-stack) - -logrus-stack provides [facebookgo/stack](https://github.com/facebookgo/stack) integration hook for [sirupsen/logrus](https://github.com/sirupsen/logrus). - -Instead of setting file, line, and func name values individually, this hook sets "caller" and/or "stack" objects containing file, line and func name. - -The values play well with `logrus.TextFormatter{}` as well as `logrus.JSONFormatter{}`. See example outputs below. - -## Doc - -There's not much to it. See usage and [GoDoc](https://godoc.org/github.com/Gurpartap/logrus-stack). - -## Usage - -```bash -$ go get github.com/Gurpartap/logrus-stack -``` - -```go -logrus.AddHook(logrus_stack.StandardHook()) -``` - -Same as: -```go -callerLevels := logrus.AllLevels -stackLevels := []logrus.Level{logrus.PanicLevel, logrus.FatalLevel, logrus.ErrorLevel} - -logrus.AddHook(logrus_stack.NewHook(callerLevels, stackLevels)) -``` - -## Example - -```go -package main - -import ( - "errors" - "os" - - "github.com/Gurpartap/logrus-stack" - "github.com/sirupsen/logrus" -) - -type Worker struct { - JobID string -} - -func (w Worker) Perform() { - logrus.WithField("jod_id", w.JobID).Infoln("Now working") - - err := errors.New("I don't know what to do yet") - if err != nil { - logrus.Errorln(err) - return - } - - // ... -} - -func main() { - // Setup logrus. - logrus.SetFormatter(&logrus.JSONFormatter{}) - logrus.SetOutput(os.Stderr) - - // Add the stack hook. - logrus.AddHook(logrus_stack.StandardHook()) - - // Let's try it. - Worker{"123"}.Perform() -} -``` - -```bash -$ go run example/main.go -``` - -```go -{"caller":{"File":"github.com/Gurpartap/logrus-stack/example/main.go","Line":16,"Name":"Worker.Perform"},"jod_id":"123","level":"info","msg":"Now working","time":"2016-10-10T01:17:40+05:30"} -{"caller":{"File":"github.com/Gurpartap/logrus-stack/example/main.go","Line":20,"Name":"Worker.Perform"},"level":"error","msg":"I don't know what to do yet","stack":[{"File":"github.com/Gurpartap/logrus-stack/example/main.go","Line":20,"Name":"Worker.Perform"},{"File":"github.com/Gurpartap/logrus-stack/example/main.go","Line":36,"Name":"main"},{"File":"/usr/local/Cellar/go/1.7.1/libexec/src/runtime/proc.go","Line":183,"Name":"main"},{"File":"/usr/local/Cellar/go/1.7.1/libexec/src/runtime/asm_amd64.s","Line":2086,"Name":"goexit"}],"time":"2016-10-10T01:17:40+05:30"} -``` - -###### Same as above but indented: - -```json -{ - "caller": { - "File": "github.com/Gurpartap/logrus-stack/example/main.go", - "Line": 16, - "Name": "Worker.Perform" - }, - "jod_id": "123", - "level": "info", - "msg": "Now working", - "time": "2016-10-10T09:41:00+05:30" -} -{ - "caller": { - "File": "github.com/Gurpartap/logrus-stack/example/main.go", - "Line": 20, - "Name": "Worker.Perform" - }, - "level": "error", - "msg": "I don't know what to do yet", - "stack": [ - { - "File": "github.com/Gurpartap/logrus-stack/example/main.go", - "Line": 20, - "Name": "Worker.Perform" - }, - { - "File": "github.com/Gurpartap/logrus-stack/example/main.go", - "Line": 36, - "Name": "main" - }, - { - "File": "/usr/local/Cellar/go/1.7.1/libexec/src/runtime/proc.go", - "Line": 183, - "Name": "main" - }, - { - "File": "/usr/local/Cellar/go/1.7.1/libexec/src/runtime/asm_amd64.s", - "Line": 2086, - "Name": "goexit" - } - ], - "time": "2016-10-10T09:41:00+05:30" -} - -``` - -If the same example was used with `logrus.SetFormatter(&logrus.TextFormatter{})` instead, the output would be: - -```bash -INFO[0000] Now working caller=github.com/Gurpartap/logrus-stack/example/main.go:16 Worker.Perform jod_id=123 -ERRO[0000] I don't know what to do yet caller=github.com/Gurpartap/logrus-stack/example/main.go:20 Worker.Perform stack=github.com/Gurpartap/logrus-stack/example/main.go:20 Worker.Perform -github.com/Gurpartap/logrus-stack/example/main.go:36 main -/usr/local/Cellar/go/1.7.1/libexec/src/runtime/proc.go:183 main -/usr/local/Cellar/go/1.7.1/libexec/src/runtime/asm_amd64.s:2086 goexit -``` - -Hello 👋 - -Follow me on https://twitter.com/Gurpartap diff --git a/vendor/github.com/Gurpartap/logrus-stack/logrus-stack-hook.go b/vendor/github.com/Gurpartap/logrus-stack/logrus-stack-hook.go deleted file mode 100644 index 78215b9c..00000000 --- a/vendor/github.com/Gurpartap/logrus-stack/logrus-stack-hook.go +++ /dev/null @@ -1,90 +0,0 @@ -package logrus_stack - -import ( - "strings" - - "github.com/facebookgo/stack" - "github.com/sirupsen/logrus" -) - -// NewHook is the initializer for LogrusStackHook{} (implementing logrus.Hook). -// Set levels to callerLevels for which "caller" value may be set, providing a -// single frame of stack. Set levels to stackLevels for which "stack" value may -// be set, providing the full stack (minus logrus). -func NewHook(callerLevels []logrus.Level, stackLevels []logrus.Level) LogrusStackHook { - return LogrusStackHook{ - CallerLevels: callerLevels, - StackLevels: stackLevels, - } -} - -// StandardHook is a convenience initializer for LogrusStackHook{} with -// default args. -func StandardHook() LogrusStackHook { - return LogrusStackHook{ - CallerLevels: logrus.AllLevels, - StackLevels: []logrus.Level{logrus.PanicLevel, logrus.FatalLevel, logrus.ErrorLevel}, - } -} - -// LogrusStackHook is an implementation of logrus.Hook interface. -type LogrusStackHook struct { - // Set levels to CallerLevels for which "caller" value may be set, - // providing a single frame of stack. - CallerLevels []logrus.Level - - // Set levels to StackLevels for which "stack" value may be set, - // providing the full stack (minus logrus). - StackLevels []logrus.Level -} - -// Levels provides the levels to filter. -func (hook LogrusStackHook) Levels() []logrus.Level { - return logrus.AllLevels -} - -// Fire is called by logrus when something is logged. -func (hook LogrusStackHook) Fire(entry *logrus.Entry) error { - var skipFrames int - if len(entry.Data) == 0 { - // When WithField(s) is not used, we have 8 logrus frames to skip. - skipFrames = 8 - } else { - // When WithField(s) is used, we have 6 logrus frames to skip. - skipFrames = 6 - } - - var frames stack.Stack - - // Get the complete stack track past skipFrames count. - _frames := stack.Callers(skipFrames) - - // Remove logrus's own frames that seem to appear after the code is through - // certain hoops. e.g. http handler in a separate package. - // This is a workaround. - for _, frame := range _frames { - if !strings.Contains(frame.File, "github.com/sirupsen/logrus") { - frames = append(frames, frame) - } - } - - if len(frames) > 0 { - // If we have a frame, we set it to "caller" field for assigned levels. - for _, level := range hook.CallerLevels { - if entry.Level == level { - entry.Data["caller"] = frames[0] - break - } - } - - // Set the available frames to "stack" field. - for _, level := range hook.StackLevels { - if entry.Level == level { - entry.Data["stack"] = frames - break - } - } - } - - return nil -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/.gitignore b/vendor/github.com/NYTimes/encoding-wrapper/.gitignore deleted file mode 100644 index c57100a5..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/.gitignore +++ /dev/null @@ -1 +0,0 @@ -coverage.txt diff --git a/vendor/github.com/NYTimes/encoding-wrapper/.travis.yml b/vendor/github.com/NYTimes/encoding-wrapper/.travis.yml deleted file mode 100644 index 167abb64..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go -install: - - make testdeps -script: make coverage -after_success: bash <(curl -s https://codecov.io/bash) -go: - - 1.8.x - - 1.9 - - tip diff --git a/vendor/github.com/NYTimes/encoding-wrapper/LICENSE b/vendor/github.com/NYTimes/encoding-wrapper/LICENSE deleted file mode 100644 index df6192d3..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016-2017 The New York Times Company - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/NYTimes/encoding-wrapper/Makefile b/vendor/github.com/NYTimes/encoding-wrapper/Makefile deleted file mode 100644 index c3ea5731..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -all: test - -testdeps: - go get -d -t ./... - -checkfmt: testdeps - [ -z "$$(gofmt -s -d . | tee /dev/stderr)" ] - -lint: testdeps - go get github.com/alecthomas/gometalinter honnef.co/go/unused/cmd/unused - gometalinter --install --vendored-linters - go install ./... - go list -f '{{.TestImports}}' ./... | sed -e 's/\[\(.*\)\]/\1/' | tr ' ' '\n' | grep '^.*\..*/.*$$' | xargs go install - gometalinter -j 4 --enable=misspell --enable=gofmt --enable=unused --disable=dupl --disable=errcheck --disable=gas --deadline=10m --tests ./... - -coverage: lint - @rm -f coverage.txt; for p in $$(go list ./...); do \ - go test -coverprofile=profile.out -covermode=atomic $$p || export status=2; \ - if [ -f profile.out ]; then cat profile.out >> coverage.txt; rm profile.out; fi \ - done; \ - exit $${status:-0} - -test: lint - go test ./... diff --git a/vendor/github.com/NYTimes/encoding-wrapper/README.md b/vendor/github.com/NYTimes/encoding-wrapper/README.md deleted file mode 100644 index 839f6a32..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# encoding-wrapper - -[![Build Status](https://travis-ci.org/NYTimes/encoding-wrapper.svg?branch=master)](https://travis-ci.org/NYTimes/encoding-wrapper) -[![codecov](https://codecov.io/gh/NYTimes/encoding-wrapper/branch/master/graph/badge.svg)](https://codecov.io/gh/NYTimes/encoding-wrapper) -[![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](https://godoc.org/github.com/NYTimes/encoding-wrapper) - -Collection of Go wrappers for Video encoding providers. - -## Supported providers - -- [Elemental Conductor](https://www.elementaltechnologies.com/products/elemental-conductor) -- [Encoding.com](http://api.encoding.com) diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/client.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/client.go deleted file mode 100644 index 94bc39c1..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/client.go +++ /dev/null @@ -1,117 +0,0 @@ -// Package elementalconductor provides types and methods for interacting with the -// Elemental Conductor API. -// -// You can get more details on the API at https:///help/rest_api. -package elementalconductor - -import ( - "crypto/md5" - "encoding/hex" - "encoding/json" - "encoding/xml" - "fmt" - "io/ioutil" - "net/http" - "strconv" - "strings" - "time" -) - -// Client is the basic type for interacting with the API. It provides methods -// matching the available actions in the API. -type Client struct { - Host string - UserLogin string - APIKey string - AuthExpires int - AccessKeyID string - SecretAccessKey string - Destination string -} - -// APIError represents an error returned by the Elemental Cloud REST API. -// -// See https:///help/rest_api#rest_basics_errors_and_warnings -// for more details. -type APIError struct { - Status int `json:"status,omitempty"` - Errors string `json:"errors,omitempty"` -} - -// Error converts the whole interlying information to a representative string. -// -// It encodes the list of errors in JSON format. -func (apiErr *APIError) Error() string { - data, _ := json.Marshal(apiErr) - return fmt.Sprintf("Error returned by the Elemental Conductor REST Interface: %s", data) -} - -// NewClient creates a instance of the client type. -func NewClient(host, userLogin, apiKey string, authExpires int, accessKeyID string, secretAccessKey string, destination string) *Client { - return &Client{ - Host: host, - UserLogin: userLogin, - APIKey: apiKey, - AuthExpires: authExpires, - AccessKeyID: accessKeyID, - SecretAccessKey: secretAccessKey, - Destination: destination, - } -} - -func getUnixTimestamp(givenTime time.Time) string { - return strconv.FormatInt(givenTime.UTC().Unix(), 10) -} - -func (c *Client) do(method string, path string, body interface{}, out interface{}) error { - apiPath := "/api" + path - xmlRequest, err := xml.Marshal(body) - if err != nil { - return err - } - req, err := http.NewRequest(method, c.Host+apiPath, strings.NewReader(string(xmlRequest))) - if err != nil { - return err - } - expiresTime := time.Now().Add(time.Duration(c.AuthExpires) * time.Second) - expiresTimestamp := getUnixTimestamp(expiresTime) - req.Header.Set("Accept", "application/xml") - req.Header.Set("Content-type", "application/xml") - req.Header.Set("X-Auth-User", c.UserLogin) - req.Header.Set("X-Auth-Expires", expiresTimestamp) - req.Header.Set("X-Auth-Key", c.createAuthKey(path, expiresTime)) - resp, err := http.DefaultClient.Do(req) - - if err != nil { - return err - } - defer resp.Body.Close() - respData, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices { - return &APIError{ - Status: resp.StatusCode, - Errors: string(respData), - } - } - if out != nil && len(respData) > 1 { - return xml.Unmarshal(respData, out) - } - return nil -} - -func (c *Client) createAuthKey(URL string, expire time.Time) string { - expireString := getUnixTimestamp(expire) - hasher := md5.New() - hasher.Write([]byte(URL)) - hasher.Write([]byte(c.UserLogin)) - hasher.Write([]byte(c.APIKey)) - hasher.Write([]byte(expireString)) - innerKey := hex.EncodeToString(hasher.Sum(nil)) - hasher = md5.New() - hasher.Write([]byte(c.APIKey)) - hasher.Write([]byte(innerKey)) - return hex.EncodeToString(hasher.Sum(nil)) -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/client_test.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/client_test.go deleted file mode 100644 index cb031f41..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/client_test.go +++ /dev/null @@ -1,121 +0,0 @@ -package elementalconductor - -import ( - "crypto/md5" - "encoding/hex" - "encoding/xml" - "io/ioutil" - "net/http" - "net/http/httptest" - "strconv" - "time" - - "gopkg.in/check.v1" -) - -func (s *S) TestNewClient(c *check.C) { - expected := Client{ - Host: "https://mycluster.cloud.elementaltechnologies.com", - UserLogin: "myuser", - APIKey: "elemental-secret-key", - AuthExpires: 45, - AccessKeyID: "aws-access-key", - SecretAccessKey: "aws-secret-key", - Destination: "destination", - } - got := NewClient("https://mycluster.cloud.elementaltechnologies.com", "myuser", "elemental-secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - c.Assert(*got, check.DeepEquals, expected) -} - -func (s *S) TestCreateAuthKey(c *check.C) { - path := "/jobs" - userID := "myuser" - APIKey := "api-key" - expire := time.Unix(1, 0) - expireTimestamp := getUnixTimestamp(expire) - innerKeyMD5 := md5.Sum([]byte(path + userID + APIKey + expireTimestamp)) - innerKey2 := hex.EncodeToString(innerKeyMD5[:]) - value := md5.Sum([]byte(APIKey + innerKey2)) - expected := hex.EncodeToString(value[:]) - client := NewClient("https://mycluster.cloud.elementaltechnologies.com", userID, APIKey, 45, "aws-access-key", "aws-secret-key", "destination") - got := client.createAuthKey(path, expire) - c.Assert(got, check.Equals, expected) -} - -func (s *S) TestDoRequiredParameters(c *check.C) { - var req *http.Request - var data []byte - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - req = r - data, _ = ioutil.ReadAll(r.Body) - w.Write([]byte(`test`)) - })) - defer server.Close() - client := NewClient(server.URL, "myuser", "elemental-secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - var respObj interface{} - myJob := Job{ - XMLName: xml.Name{ - Local: "job", - }, - Input: Input{ - FileInput: Location{ - URI: "http://another.non.existent/video.mp4", - Username: "user", - Password: "pass123", - }, - }, - } - err := client.do("POST", "/jobs", myJob, &respObj) - - c.Assert(err, check.IsNil) - c.Assert(req, check.NotNil) - c.Assert(req.Method, check.Equals, "POST") - c.Assert(req.URL.Path, check.Equals, "/api/jobs") - c.Assert(req.Header.Get("Accept"), check.Equals, "application/xml") - c.Assert(req.Header.Get("Content-type"), check.Equals, "application/xml") - c.Assert(req.Header.Get("X-Auth-User"), check.Equals, client.UserLogin) - - c.Assert(req.Header.Get("X-Auth-Expires"), check.NotNil) - timestampInt, err := strconv.ParseInt(req.Header.Get("X-Auth-Expires"), 10, 64) - c.Assert(err, check.IsNil) - timestampTime := time.Unix(timestampInt, 0) - - c.Assert( - req.Header.Get("X-Auth-Key"), - check.Equals, - client.createAuthKey("/jobs", timestampTime), - ) - var reqJob Job - - err = xml.Unmarshal(data, &reqJob) - - c.Assert(err, check.IsNil) - c.Assert(reqJob, check.DeepEquals, myJob) -} - -func (s *S) TestInvalidAuth(c *check.C) { - errorResponse := ` - - You must be logged in to access this page. -` - server, _ := s.startServer(http.StatusUnauthorized, errorResponse) - defer server.Close() - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - getJobsResponse, err := client.GetJob("1") - c.Assert(getJobsResponse, check.IsNil) - c.Assert(err, check.DeepEquals, &APIError{ - Status: http.StatusUnauthorized, - Errors: errorResponse, - }) -} - -func (s *S) TestAPIErrorMarshalling(c *check.C) { - err := &APIError{ - Status: http.StatusInternalServerError, - Errors: "something went wrong", - } - expectedError := `Error returned by the Elemental Conductor REST Interface: {"status":500,"errors":"something went wrong"}` - c.Assert(err.Error(), check.Equals, expectedError) -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/config.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/config.go deleted file mode 100644 index 0f591a28..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/config.go +++ /dev/null @@ -1,21 +0,0 @@ -package elementalconductor - -import "encoding/xml" - -// CloudConfig contains configuration for Elemental Cloud, including Autoscaler -// Settings. -type CloudConfig struct { - XMLName xml.Name `xml:"cloud_config"` - AuthorizedNodeCount int `xml:"authorized_node_count"` - MaxNodes int `xml:"max_cluster_size"` - MinNodes int `xml:"min_cluster_size"` - WorkerVariant string `xml:"worker_variant"` -} - -// GetCloudConfig returns the current Elemental Cloud configuration. It -// includes Autoscaler Settings. -func (c *Client) GetCloudConfig() (*CloudConfig, error) { - var config CloudConfig - err := c.do("GET", "/config/cloud", nil, &config) - return &config, err -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/config_test.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/config_test.go deleted file mode 100644 index 61883709..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/config_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package elementalconductor - -import ( - "encoding/xml" - "net/http" - - "gopkg.in/check.v1" -) - -func (s *S) TestGetCloudConfig(c *check.C) { - data := ` - - 500 - 30 - 4 - production_server_cloud -` - server, requests := s.startServer(http.StatusOK, data) - defer server.Close() - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - config, err := client.GetCloudConfig() - c.Assert(err, check.IsNil) - c.Assert(*config, check.DeepEquals, CloudConfig{ - XMLName: xml.Name{Local: "cloud_config"}, - AuthorizedNodeCount: 500, - MaxNodes: 30, - MinNodes: 4, - WorkerVariant: "production_server_cloud", - }) - fakeReq := <-requests - c.Assert(fakeReq.req.Method, check.Equals, "GET") - c.Assert(fakeReq.req.URL.Path, check.Equals, "/api/config/cloud") -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/job.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/job.go deleted file mode 100644 index 501443fb..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/job.go +++ /dev/null @@ -1,255 +0,0 @@ -package elementalconductor - -import ( - "encoding/xml" - "regexp" - "strconv" - "strings" -) - -var nonDigitRegexp = regexp.MustCompile(`[^\d]`) - -// OutputGroupType is a custom type for OutputGroup type field values -type OutputGroupType string - -const ( - // FileOutputGroupType is the value for the type field on OutputGroup - // for jobs with a file output - FileOutputGroupType = OutputGroupType("file_group_settings") - // AppleLiveOutputGroupType is the value for the type field on OutputGroup - // for jobs with Apple's HTTP Live Streaming (HLS) output - AppleLiveOutputGroupType = OutputGroupType("apple_live_group_settings") -) - -// Container is the Video container type for a job -type Container string - -const ( - // AppleHTTPLiveStreaming is the container for HLS video files - AppleHTTPLiveStreaming = Container("m3u8") - // MPEG4 is the container for MPEG-4 video files - MPEG4 = Container("mp4") -) - -// GetJobs returns a list of the user's jobs -func (c *Client) GetJobs() (*JobList, error) { - var result *JobList - err := c.do("GET", "/jobs", nil, &result) - if err != nil { - return nil, err - } - return result, nil -} - -// GetJob returns metadata on a single job -func (c *Client) GetJob(jobID string) (*Job, error) { - var result *Job - err := c.do("GET", "/jobs/"+jobID, nil, &result) - if err != nil { - return nil, err - } - return result, nil -} - -// CreateJob sends a single job to the current Elemental -// Cloud deployment for processing -func (c *Client) CreateJob(job *Job) (*Job, error) { - var result *Job - err := c.do("POST", "/jobs", *job, &result) - if err != nil { - return nil, err - } - return result, nil -} - -// CancelJob cancels the given job in the Elemental Conductor API. -func (c *Client) CancelJob(jobID string) (*Job, error) { - var job *Job - var payload = struct { - XMLName xml.Name `xml:"cancel"` - }{} - err := c.do("POST", "/jobs/"+jobID+"/cancel", payload, &job) - if err != nil { - return nil, err - } - return job, nil -} - -// GetID is a convenience function to parse the job id -// out of the Href attribute in Job -func (j *Job) GetID() string { - if j.Href != "" { - hrefData := strings.Split(j.Href, "/") - return hrefData[len(hrefData)-1] - } - return "" -} - -// JobList represents the response returned by -// a query for the list of jobs -type JobList struct { - XMLName xml.Name `xml:"job_list"` - Empty string `xml:"empty,omitempty"` - Job []Job `xml:"job"` -} - -// Job represents a job to be sent to Elemental Cloud -type Job struct { - XMLName xml.Name `xml:"job"` - Href string `xml:"href,attr,omitempty"` - Input Input `xml:"input,omitempty"` - ContentDuration *ContentDuration `xml:"content_duration,omitempty"` - Priority int `xml:"priority,omitempty"` - OutputGroup []OutputGroup `xml:"output_group,omitempty"` - StreamAssembly []StreamAssembly `xml:"stream_assembly,omitempty"` - Status string `xml:"status,omitempty"` - Submitted DateTime `xml:"submitted,omitempty"` - StartTime DateTime `xml:"start_time,omitempty"` - CompleteTime DateTime `xml:"complete_time,omitempty"` - ErroredTime DateTime `xml:"errored_time,omitempty"` - PercentComplete int `xml:"pct_complete,omitempty"` - ErrorMessages []JobError `xml:"error_messages,omitempty"` -} - -// JobError represents an individual error on a job -type JobError struct { - Code int `xml:"error>code,omitempty"` - CreatedAt JobErrorDateTime `xml:"error>created_at,omitempty"` - Message string `xml:"error>message,omitempty"` -} - -// Input represents the spec for the job's input -type Input struct { - FileInput Location `xml:"file_input,omitempty"` - InputInfo *InputInfo `xml:"input_info,omitempty"` -} - -// InputInfo contains metadata related to a job input. -type InputInfo struct { - Video VideoInputInfo `xml:"video"` -} - -// VideoInputInfo contains video metadata related to a job input. -type VideoInputInfo struct { - Format string `xml:"format"` - FormatInfo string `xml:"format_info"` - FormatProfile string `xml:"format_profile"` - CodecID string `xml:"codec_id"` - CodecIDInfo string `xml:"codec_id_info"` - Bitrate string `xml:"bit_rate"` - Width string `xml:"width"` - Height string `xml:"height"` -} - -// GetWidth parses the underlying width returned the Elemental Conductor API -// and converts it to int64. -// -// Examples: -// - Input: "1 920 pixels" -// Output: 1920 -// - Input: "1920p" -// Output: 1920 -// - Input: "1 920" -// Output: 1920 -func (v *VideoInputInfo) GetWidth() int64 { - return v.extractNumber(v.Width) -} - -// GetHeight parses the underlying height returned the Elemental Conductor API -// and converts it to int64. -// -// Examples: -// - Input: "1 080 pixels" -// Output: 1080 -// - Input: "1080p" -// Output: 1080 -// - Input: "1 080" -// Output: 1080 -func (v *VideoInputInfo) GetHeight() int64 { - return v.extractNumber(v.Height) -} - -func (v *VideoInputInfo) extractNumber(input string) int64 { - input = nonDigitRegexp.ReplaceAllString(input, "") - n, _ := strconv.ParseInt(input, 10, 64) - return n -} - -// ContentDuration contains information about the content of the media in the -// job. -type ContentDuration struct { - InputDuration int `xml:"input_duration"` -} - -// Location defines where a file is or needs to be. -// Username and Password are required for certain -// protocols that require authentication, like S3 -type Location struct { - URI string `xml:"uri,omitempty"` - Username string `xml:"username,omitempty"` - Password string `xml:"password,omitempty"` -} - -// OutputGroup is a list of the indended outputs for the job -type OutputGroup struct { - Order int `xml:"order,omitempty"` - FileGroupSettings *FileGroupSettings `xml:"file_group_settings,omitempty"` - AppleLiveGroupSettings *AppleLiveGroupSettings `xml:"apple_live_group_settings,omitempty"` - Type OutputGroupType `xml:"type,omitempty"` - Output []Output `xml:"output,omitempty"` -} - -// FileGroupSettings define where the file job output should go -type FileGroupSettings struct { - Destination *Location `xml:"destination,omitempty"` -} - -// AppleLiveGroupSettings define where the HLS job output should go -type AppleLiveGroupSettings struct { - Destination *Location `xml:"destination,omitempty"` - SegmentDuration uint `xml:"segment_length,omitempty"` - EmitSingleFile bool `xml:"emit_single_file,omitempty"` -} - -// Output defines the different processing stream assemblies -// for the job -type Output struct { - FullURI string `xml:"full_uri,omitempty"` - StreamAssemblyName string `xml:"stream_assembly_name,omitempty"` - NameModifier string `xml:"name_modifier,omitempty"` - Order int `xml:"order,omitempty"` - Extension string `xml:"extension,omitempty"` - Container Container `xml:"container,omitempty"` -} - -// StreamAssembly defines how each processing stream should behave -type StreamAssembly struct { - ID string `xml:"id,omitempty"` - Name string `xml:"name,omitempty"` - Preset string `xml:"preset,omitempty"` - VideoDescription *StreamVideoDescription `xml:"video_description"` -} - -// StreamVideoDescription contains information about the video in a given -// stream assembly. -type StreamVideoDescription struct { - Codec string `xml:"codec"` - EncoderType string `xml:"encoder_type"` - Height string `xml:"height"` - Width string `xml:"width"` -} - -// GetWidth returns the underlying width parsed as an int64. -func (s *StreamVideoDescription) GetWidth() int64 { - return s.getNumber(s.Width) -} - -// GetHeight returns the underlying height parsed as an int64. -func (s *StreamVideoDescription) GetHeight() int64 { - return s.getNumber(s.Height) -} - -func (s *StreamVideoDescription) getNumber(input string) int64 { - v, _ := strconv.ParseInt(input, 10, 64) - return v -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/job_test.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/job_test.go deleted file mode 100644 index ef2357f7..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/job_test.go +++ /dev/null @@ -1,536 +0,0 @@ -package elementalconductor - -import ( - "encoding/xml" - "net/http" - - "gopkg.in/check.v1" -) - -func (s *S) TestGetJobError(c *check.C) { - errorResponse := ` - - Couldn't find Job with id=1 -` - server, _ := s.startServer(http.StatusNotFound, errorResponse) - defer server.Close() - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - getJobsResponse, err := client.GetJob("1") - c.Assert(getJobsResponse, check.IsNil) - c.Assert(err, check.DeepEquals, &APIError{ - Status: http.StatusNotFound, - Errors: errorResponse, - }) -} - -func (s *S) TestGetJobsOnEmptyList(c *check.C) { - server, _ := s.startServer(http.StatusOK, ` - - There are currently no jobs -`) - defer server.Close() - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - getJobsResponse, err := client.GetJobs() - c.Assert(err, check.IsNil) - c.Assert(getJobsResponse, check.DeepEquals, &JobList{ - XMLName: xml.Name{ - Local: "job_list", - }, - Empty: "There are currently no jobs", - }) -} - -func (s *S) TestCreateJob(c *check.C) { - jobResponseXML := ` - - - http://another.non.existent/video.mp4 - user - pass123 - - - 50 - - 1 - - - http://destination/video.mp4 - user - pass123 - - - - - http://destination/video.mp4 - user - pass123 - - - apple_live_group_settings - - stream_1 - _high - 1 - .mp4 - - - - stream_1 - 17 - -` - server, _ := s.startServer(http.StatusCreated, jobResponseXML) - defer server.Close() - jobInput := Job{ - XMLName: xml.Name{ - Local: "job", - }, - Href: "/jobs/1", - Input: Input{ - FileInput: Location{ - URI: "http://another.non.existent/video.mp4", - Username: "user", - Password: "pass123", - }, - }, - Priority: 50, - OutputGroup: []OutputGroup{ - { - Order: 1, - FileGroupSettings: &FileGroupSettings{ - Destination: &Location{ - URI: "http://destination/video.mp4", - Username: "user", - Password: "pass123", - }, - }, - AppleLiveGroupSettings: &AppleLiveGroupSettings{ - Destination: &Location{ - URI: "http://destination/video.mp4", - Username: "user", - Password: "pass123", - }, - }, - Type: AppleLiveOutputGroupType, - Output: []Output{ - { - StreamAssemblyName: "stream_1", - NameModifier: "_high", - Order: 1, - Extension: ".mp4", - }, - }, - }, - }, - StreamAssembly: []StreamAssembly{ - { - Name: "stream_1", - Preset: "17", - }, - }, - } - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - postJobResponse, err := client.CreateJob(&jobInput) - c.Assert(err, check.IsNil) - c.Assert(postJobResponse, check.NotNil) - c.Assert(postJobResponse, check.DeepEquals, &jobInput) -} - -func (s *S) TestGetJob(c *check.C) { - jobResponseXML := ` - - - http://another.non.existent/video.mp4 - user - pass123 - - - - MPEG-4 - QuickTime - qt - 185 MiB - 1mn 19s - 19.4 Mbps - - - - - 3 - Time code - QuickTime TC - - - - - 716 - 716 - 1 - 716 - 1 - 716 - - 50 - - 1 - - - http://destination/video.mp4 - user - pass123 - - - file_group_settings - - s3://mybucket/some/dir/mynicefile.mp4 - stream_1 - _high - 1 - .mp4 - - - - 1146 - stream_1 - 17 - - None - true - true - gpu - - false - 1080 - 1366 - false - None - 50 - false - false - false - - 0 - - h.264 - - -` - server, _ := s.startServer(http.StatusOK, jobResponseXML) - defer server.Close() - expectedJob := Job{ - XMLName: xml.Name{ - Local: "job", - }, - Href: "/jobs/1", - Input: Input{ - FileInput: Location{ - URI: "http://another.non.existent/video.mp4", - Username: "user", - Password: "pass123", - }, - InputInfo: &InputInfo{ - Video: VideoInputInfo{ - Bitrate: "19.2 Mbps", - Format: "AVC", - FormatInfo: "Advanced Video Codec", - FormatProfile: "Main@L4.1", - CodecID: "avc1", - CodecIDInfo: "Advanced Video Coding", - Width: "1 920 pixels", - Height: "1 080 pixels", - }, - }, - }, - ContentDuration: &ContentDuration{InputDuration: 716}, - Priority: 50, - OutputGroup: []OutputGroup{ - { - Order: 1, - FileGroupSettings: &FileGroupSettings{ - Destination: &Location{ - URI: "http://destination/video.mp4", - Username: "user", - Password: "pass123", - }, - }, - Type: FileOutputGroupType, - Output: []Output{ - { - FullURI: "s3://mybucket/some/dir/mynicefile.mp4", - StreamAssemblyName: "stream_1", - NameModifier: "_high", - Order: 1, - Extension: ".mp4", - }, - }, - }, - }, - StreamAssembly: []StreamAssembly{ - { - ID: "1146", - Name: "stream_1", - Preset: "17", - VideoDescription: &StreamVideoDescription{ - Codec: "h.264", - EncoderType: "gpu", - Width: "", - Height: "1080", - }, - }, - }, - } - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - getJobsResponse, err := client.GetJob("1") - c.Assert(err, check.IsNil) - c.Assert(getJobsResponse, check.NotNil) - c.Assert(*getJobsResponse, check.DeepEquals, expectedJob) -} - -func (s *S) TestJobGetID(c *check.C) { - var tests = []struct { - href string - id string - }{ - { - "http://myelemental/jobs/123", - "123", - }, - { - "job-1234", - "job-1234", - }, - { - "", - "", - }, - } - for _, test := range tests { - j := Job{Href: test.href} - id := j.GetID() - c.Check(id, check.Equals, test.id) - } -} - -func (s *S) TestCancelJob(c *check.C) { - jobResponseXML := ` - canceled - - - http://another.non.existent/video.mp4 - user - pass123 - - - 50 - - 1 - - - http://destination/video.mp4 - user - pass123 - - - file_group_settings - - stream_1 - _high - 1 - .mp4 - - - - stream_1 - 17 - -` - server, reqs := s.startServer(http.StatusOK, jobResponseXML) - defer server.Close() - expectedJob := Job{ - XMLName: xml.Name{ - Local: "job", - }, - Href: "/jobs/1", - Input: Input{ - FileInput: Location{ - URI: "http://another.non.existent/video.mp4", - Username: "user", - Password: "pass123", - }, - }, - Priority: 50, - OutputGroup: []OutputGroup{ - { - Order: 1, - FileGroupSettings: &FileGroupSettings{ - Destination: &Location{ - URI: "http://destination/video.mp4", - Username: "user", - Password: "pass123", - }, - }, - Type: FileOutputGroupType, - Output: []Output{ - { - StreamAssemblyName: "stream_1", - NameModifier: "_high", - Order: 1, - Extension: ".mp4", - }, - }, - }, - }, - StreamAssembly: []StreamAssembly{ - { - Name: "stream_1", - Preset: "17", - }, - }, - Status: "canceled", - } - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - job, err := client.CancelJob("1") - c.Assert(err, check.IsNil) - c.Assert(job, check.NotNil) - c.Assert(job, check.DeepEquals, &expectedJob) - - req := <-reqs - c.Assert(req.req.Method, check.Equals, "POST") - c.Assert(req.req.URL.Path, check.Equals, "/api/jobs/1/cancel") - c.Assert(string(req.body), check.Equals, "") -} - -func (s *S) TestCancelJobError(c *check.C) { - errorResponse := ` - - Couldn't find Job with id=1 -` - server, _ := s.startServer(http.StatusNotFound, errorResponse) - defer server.Close() - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - job, err := client.CancelJob("1") - c.Assert(job, check.IsNil) - c.Assert(err, check.DeepEquals, &APIError{ - Status: http.StatusNotFound, - Errors: errorResponse, - }) -} - -func (s *S) TestVideoInfoDimensions(c *check.C) { - var tests = []struct { - inputWidth string - inputHeight string - expectedWith int64 - expectedHeight int64 - }{ - { - "1 920 pixels", - "1 080 pixels", - 1920, - 1080, - }, - { - "1280 pixels", - "720 pixels", - 1280, - 720, - }, - { - "1 280 pixels", - "720 pixels", - 1280, - 720, - }, - { - "1,280 pixels", - "720 pixels", - 1280, - 720, - }, - { - "1920p", - "1080p", - 1920, - 1080, - }, - { - "1280", - "720", - 1280, - 720, - }, - { - "twelve eighty", - "seven twenty", - 0, - 0, - }, - } - for _, t := range tests { - job := VideoInputInfo{Width: t.inputWidth, Height: t.inputHeight} - width := job.GetWidth() - height := job.GetHeight() - if width != t.expectedWith { - c.Errorf("width=%s height=%s\nwant width=%d\ngot width=%d", t.inputWidth, t.inputHeight, t.expectedWith, width) - } - if height != t.expectedHeight { - c.Errorf("width=%s height=%s\nwant height=%d\ngot height=%d", t.inputWidth, t.inputHeight, t.expectedHeight, height) - } - } -} - -func (s *S) TestVideoDescriptionWidth(c *check.C) { - var tests = []struct { - input string - output int64 - }{ - {"1920", 1920}, - {"", 0}, - {"whatever", 0}, - } - for _, t := range tests { - desc := StreamVideoDescription{Width: t.input} - got := desc.GetWidth() - c.Check(got, check.Equals, t.output) - } -} - -func (s *S) TestVideoDescriptionHeight(c *check.C) { - var tests = []struct { - input string - output int64 - }{ - {"1080", 1080}, - {"", 0}, - {"whatever", 0}, - } - for _, t := range tests { - desc := StreamVideoDescription{Height: t.input} - got := desc.GetHeight() - c.Check(got, check.Equals, t.output) - } -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/node.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/node.go deleted file mode 100644 index 871ee626..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/node.go +++ /dev/null @@ -1,48 +0,0 @@ -package elementalconductor - -import "encoding/xml" - -// NodeProduct is the product that is running inside a node. -type NodeProduct string - -const ( - // ProductConductorFile is condutor file product. - ProductConductorFile = NodeProduct("Conductor File") - - // ProductServer is the server product. - ProductServer = NodeProduct("Server") -) - -type nodeList struct { - XMLName xml.Name `xml:"node_list"` - Nodes []Node `xml:"node"` -} - -// Node is a server running one of Elemental products in one of its platforms. -type Node struct { - Href string `xml:"href,attr"` - Name string `xml:"name"` - HostName string `xml:"hostname"` - IPAddress string `xml:"ip_addr"` - PublicIPAddress string `xml:"public_ip_addr,omitempty"` - Eth0Mac string `xml:"eth0_mac"` - Status string `xml:"status"` - Product NodeProduct `xml:"product"` - Version string `xml:"version"` - Platform string `xml:"platform"` - Packages []string `xml:"packages>package"` - Licenses []string `xml:"licenses>license"` - CreatedAt DateTime `xml:"created_at"` - RunningCount int `xml:"running_count,omitempty"` -} - -// GetNodes returns the list of nodes currently available in the Elemental -// setup. -func (c *Client) GetNodes() ([]Node, error) { - var result nodeList - err := c.do("GET", "/nodes", nil, &result) - if err != nil { - return nil, err - } - return result.Nodes, nil -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/node_test.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/node_test.go deleted file mode 100644 index 7897bf70..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/node_test.go +++ /dev/null @@ -1,138 +0,0 @@ -package elementalconductor - -import ( - "net/http" - "time" - - "gopkg.in/check.v1" -) - -func (s *S) TestGetNodes(c *check.C) { - server, requests := s.startServer(http.StatusOK, ` - - - Conductor - ip-192-168-1-140 - 192.168.1.140 - 0E:C8:60:FA:3C:01 - active - Conductor File - 1.0.0v123 - cloud - - Audio Normalization Package - Audio Package - - - srs_norm - dolby_ac3 - dolby_eac3 - dts - - 2015-12-02 15:15:59 -0300 - - - Node 1 - ip-192-168-1-141 - 192.168.1.141 - 50.10.10.199 - 0E:C8:60:FA:3C:02 - active - Server - 1.0.0v123 - cloud - - Audio Normalization Package - Audio Package - - - srs_norm - dolby_ac3 - dolby_eac3 - dts - - 2016-03-01 09:42:23 -0300 - - - 80 - - - Node 2 - ip-192-168-1-142 - 192.168.1.142 - 0E:C8:61:FA:3C:03 - active - Server - 1.0.0v123 - cloud - - Audio Normalization Package - Audio Package - - - srs_norm - dolby_ac3 - dolby_eac3 - dts - - 2016-03-25 21:49:01 -0300 - - - 120 - -`) - defer server.Close() - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - nodes, err := client.GetNodes() - c.Assert(err, check.IsNil) - c.Assert(nodes, check.DeepEquals, []Node{ - { - Href: "/nodes/1", - Name: "Conductor", - HostName: "ip-192-168-1-140", - IPAddress: "192.168.1.140", - Eth0Mac: "0E:C8:60:FA:3C:01", - Status: "active", - Product: ProductConductorFile, - Version: "1.0.0v123", - Platform: "cloud", - Packages: []string{"Audio Normalization Package", "Audio Package"}, - Licenses: []string{"srs_norm", "dolby_ac3", "dolby_eac3", "dts"}, - CreatedAt: DateTime{Time: time.Date(2015, time.December, 2, 18, 15, 59, 0, time.UTC)}, - }, - { - Href: "/nodes/31", - Name: "Node 1", - HostName: "ip-192-168-1-141", - IPAddress: "192.168.1.141", - PublicIPAddress: "50.10.10.199", - Eth0Mac: "0E:C8:60:FA:3C:02", - Status: "active", - Product: ProductServer, - Version: "1.0.0v123", - Platform: "cloud", - Packages: []string{"Audio Normalization Package", "Audio Package"}, - Licenses: []string{"srs_norm", "dolby_ac3", "dolby_eac3", "dts"}, - CreatedAt: DateTime{Time: time.Date(2016, time.March, 1, 12, 42, 23, 0, time.UTC)}, - RunningCount: 80, - }, - { - Href: "/nodes/40", - Name: "Node 2", - HostName: "ip-192-168-1-142", - IPAddress: "192.168.1.142", - Eth0Mac: "0E:C8:61:FA:3C:03", - Status: "active", - Product: ProductServer, - Version: "1.0.0v123", - Platform: "cloud", - Packages: []string{"Audio Normalization Package", "Audio Package"}, - Licenses: []string{"srs_norm", "dolby_ac3", "dolby_eac3", "dts"}, - CreatedAt: DateTime{Time: time.Date(2016, time.March, 26, 0, 49, 1, 0, time.UTC)}, - RunningCount: 120, - }, - }) - fakeReq := <-requests - c.Assert(fakeReq.req.Method, check.Equals, "GET") - c.Assert(fakeReq.req.URL.Path, check.Equals, "/api/nodes") -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/presets.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/presets.go deleted file mode 100644 index f17f4aed..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/presets.go +++ /dev/null @@ -1,68 +0,0 @@ -package elementalconductor - -import "encoding/xml" - -// GetPresets returns a list of presets -func (c *Client) GetPresets() (*PresetList, error) { - var result *PresetList - err := c.do("GET", "/presets", nil, &result) - if err != nil { - return nil, err - } - return result, nil -} - -// GetPreset return details of a given presetID -func (c *Client) GetPreset(presetID string) (*Preset, error) { - var result *Preset - err := c.do("GET", "/presets/"+presetID, nil, &result) - if err != nil { - return nil, err - } - - return result, nil -} - -// CreatePreset creates a new preset -func (c *Client) CreatePreset(preset *Preset) (*Preset, error) { - var result *Preset - err := c.do("POST", "/presets", preset, &result) - if err != nil { - return nil, err - } - - return result, nil -} - -// DeletePreset removes a preset based on its presetID -func (c *Client) DeletePreset(presetID string) error { - return c.do("DELETE", "/presets/"+presetID, nil, nil) -} - -// PresetList represents the response returned by -// a query for the list of jobs -type PresetList struct { - Presets []Preset `xml:"preset"` -} - -// Preset represents a preset -type Preset struct { - XMLName xml.Name `xml:"preset"` - Name string `xml:"name"` - Href string `xml:"href,attr,omitempty"` - Permalink string `xml:"permalink,omitempty"` - Description string `xml:"description,omitempty"` - Container string `xml:"container,omitempty"` - Width string `xml:"video_description>width,omitempty"` - Height string `xml:"video_description>height,omitempty"` - VideoCodec string `xml:"video_description>codec,omitempty"` - VideoBitrate string `xml:"video_description>h264_settings>bitrate,omitempty"` - GopSize string `xml:"video_description>h264_settings>gop_size,omitempty"` - GopMode string `xml:"video_description>h264_settings>gop_mode,omitempty"` - Profile string `xml:"video_description>h264_settings>profile,omitempty"` - ProfileLevel string `xml:"video_description>h264_settings>level,omitempty"` - RateControl string `xml:"video_description>h264_settings>rate_control_mode,omitempty"` - InterlaceMode string `xml:"video_description>h264_settings>interlace_mode,omitempty"` - AudioCodec string `xml:"audio_description>codec,omitempty"` - AudioBitrate string `xml:"audio_description>aac_settings>bitrate,omitempty"` -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/presets_test.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/presets_test.go deleted file mode 100644 index 4eea25e0..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/presets_test.go +++ /dev/null @@ -1,482 +0,0 @@ -package elementalconductor - -import ( - "encoding/xml" - "net/http" - - "gopkg.in/check.v1" -) - -func (s *S) TestGetPresets(c *check.C) { - presetsResponseXML := ` - - - iPhone - iphone - Default output for iPhone - Devices - - - iPhone_ADAPT_HIGH - iphone_adapt_high - Default output for iPhone Adaptive high quality - Devices - - -` - - expectedPreset1 := Preset{ - XMLName: xml.Name{Local: "preset"}, - Name: "iPhone", - Href: "/presets/1", - Permalink: "iphone", - Description: "Default output for iPhone", - } - - expectedPreset2 := Preset{ - XMLName: xml.Name{Local: "preset"}, - Name: "iPhone_ADAPT_HIGH", - Href: "/presets/2", - Permalink: "iphone_adapt_high", - Description: "Default output for iPhone Adaptive high quality", - } - - var expectedOutput PresetList - expectedOutput.Presets = make([]Preset, 2) - expectedOutput.Presets[0] = expectedPreset1 - expectedOutput.Presets[1] = expectedPreset2 - - server, _ := s.startServer(http.StatusOK, presetsResponseXML) - defer server.Close() - - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - getPresetsResponse, _ := client.GetPresets() - c.Assert(getPresetsResponse, check.DeepEquals, &expectedOutput) -} - -func (s *S) TestGetPreset(c *check.C) { - presetResponseXML := ` - - iPhone - iphone - Default output for iPhone - Devices - mp4 - - 1 - false - - true - - false - - None - true - true - - - false - 320 - 1 - false - None - 50 - false - false - false - 480 - - medium - 960000 - - - false - off - false - 1 - false - 24 - false - 1 - false - 0 - 80 - 1 - false - medium - - - 0 - - 1 - 1 - false - 1 - 1 - - - false - true - false - 1 - false - - 0 - None - false - 3 - Baseline - ABR - fixed - progressive - - - - h.264 - - - interpolate - Deinterlace - false - 85 - - - - - 0 - false - false - 1 - - 1 - - - 128000 - 2_0 - 1 - false - false - 44100 - LC - CBR - - aac - -` - - expectedPreset := Preset{ - XMLName: xml.Name{Local: "preset"}, - Name: "iPhone", - Href: "/presets/1", - Permalink: "iphone", - Description: "Default output for iPhone", - Container: "mp4", - VideoCodec: "h.264", - AudioCodec: "aac", - Width: "480", - Height: "320", - VideoBitrate: "960000", - AudioBitrate: "128000", - GopSize: "80", - GopMode: "fixed", - Profile: "Baseline", - ProfileLevel: "3", - RateControl: "ABR", - InterlaceMode: "progressive", - } - - server, _ := s.startServer(http.StatusOK, presetResponseXML) - defer server.Close() - - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - getPresetResponse, _ := client.GetPreset("1") - c.Assert(getPresetResponse, check.DeepEquals, &expectedPreset) -} - -func (s *S) TestGetPresetForHls(c *check.C) { - presetHLSResponseXML := ` - nyt_hls_720p_high_uhd - nyt_hls_720p_high_uhd - - Devices - m3u8 - - 16 - 200 - 0 - true - - 0 - 1 - - 482-498 - 480 - 503 - 500 - 502 - 481 - 481 - - false - - None - true - true - - - false - 720 - 501 - false - None - 50 - false - false - false - - - medium - 3800000 - - 7600000 - false - off - false - - true - - false - 1 - false - 2 - 90 - 439 - false - high - 4750000 - - 0 - - 1 - 1 - false - 1 - 2 - - - false - true - false - 1 - false - - 0 - None - false - 3.1 - Main - VBR - fixed - progressive - - - - h.264 - - - interpolate - Deinterlace - false - 376 - - - - - 0 - false - false - 516 - - 1 - - - 64000 - 2_0 - 435 - false - false - 44100 - LC - CBR - - aac - -` - - expectedPreset := Preset{ - XMLName: xml.Name{Local: "preset"}, - Name: "nyt_hls_720p_high_uhd", - Href: "/presets/149", - Permalink: "nyt_hls_720p_high_uhd", - Container: "m3u8", - VideoCodec: "h.264", - AudioCodec: "aac", - Height: "720", - VideoBitrate: "3800000", - AudioBitrate: "64000", - GopSize: "90", - GopMode: "fixed", - Profile: "Main", - ProfileLevel: "3.1", - RateControl: "VBR", - InterlaceMode: "progressive", - } - - server, _ := s.startServer(http.StatusOK, presetHLSResponseXML) - defer server.Close() - - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - getPresetResponse, _ := client.GetPreset("149") - c.Assert(getPresetResponse, check.DeepEquals, &expectedPreset) -} - -func (s *S) TestCreatePreset(c *check.C) { - createPresetResponseXML := ` - - TestPresetName - - Preset test here - mp4 - - 163 - false - - false - - false - - None - true - true - - - false - 720 - 602 - false - None - 50 - false - false - false - - - medium - 3800000 - - - true - off - false - - true - - false - 1 - false - 2 - 90 - 540 - false - medium - - - 0 - - 1 - - true - - 1 - - - false - true - false - 1 - false - - 0 - None - false - 3.1 - Main - VBR - fixed - progressive - - - - h.264 - - - 0 - false - false - 617 - - 1 - - - 64000 - 2_0 - 536 - false - false - 48000 - LC - CBR - - aac - -` - server, _ := s.startServer(http.StatusOK, createPresetResponseXML) - defer server.Close() - - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - preset := Preset{ - XMLName: xml.Name{Local: "preset"}, - Name: "TestPresetName", - Description: "Preset test here", - Container: "mp4", - VideoCodec: "h.264", - AudioCodec: "aac", - Height: "720", - VideoBitrate: "3800000", - AudioBitrate: "64000", - GopSize: "90", - GopMode: "fixed", - Profile: "Main", - ProfileLevel: "3.1", - RateControl: "VBR", - InterlaceMode: "progressive", - } - - res, _ := client.CreatePreset(&preset) - c.Assert(res, check.DeepEquals, &preset) -} - -func (s *S) TestDeletePreset(c *check.C) { - presetsResponse := ` ` - server, _ := s.startServer(http.StatusOK, presetsResponse) - defer server.Close() - - client := NewClient(server.URL, "myuser", "secret-key", 45, "aws-access-key", "aws-secret-key", "destination") - - deletePresetResponse := client.DeletePreset("preset123") - c.Assert(deletePresetResponse, check.DeepEquals, nil) -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/suite_test.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/suite_test.go deleted file mode 100644 index f407ad22..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package elementalconductor - -import ( - "io/ioutil" - "net/http" - "net/http/httptest" - "testing" - - "gopkg.in/check.v1" -) - -type S struct{} - -func Test(t *testing.T) { - check.TestingT(t) -} - -var _ = check.Suite(&S{}) - -type fakeServerRequest struct { - req *http.Request - body []byte -} - -func (s *S) startServer(status int, content string) (*httptest.Server, chan fakeServerRequest) { - requests := make(chan fakeServerRequest, 1) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - data, _ := ioutil.ReadAll(r.Body) - fakeRequest := fakeServerRequest{req: r, body: data} - requests <- fakeRequest - w.WriteHeader(status) - w.Write([]byte(content)) - })) - return server, requests -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/time.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/time.go deleted file mode 100644 index 3e837bf8..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/time.go +++ /dev/null @@ -1,73 +0,0 @@ -package elementalconductor - -import ( - "encoding/xml" - "time" -) - -const ( - dateTimeLayout = "2006-01-02 15:04:05 -0700" - errorDateTimeLayout = "2006-01-02T15:04:05-07:00" -) - -// DateTime is a custom struct for representing time within ElementalConductor. -// It customizes marshalling, and always store the underlying time in UTC. -type DateTime struct { - time.Time -} - -// MarshalXML implementation on DateTimeg to skip "zero" time values -func (jdt DateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - if !jdt.IsZero() { - e.EncodeElement(jdt.Time.Format(dateTimeLayout), start) - } - return nil -} - -// UnmarshalXML implementation on DateTimeg to use dateTimeLayout -func (jdt *DateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - var err error - jdt.Time, err = unmarshalTime(d, start, dateTimeLayout) - return err -} - -// JobErrorDateTime is a custom time struct to be used on Media items -type JobErrorDateTime struct { - time.Time -} - -// MarshalXML implementation on JobErrorDateTime to skip "zero" time values -func (jdt JobErrorDateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - if !jdt.IsZero() { - e.EncodeElement(jdt.Time.Format(errorDateTimeLayout), start) - } - return nil -} - -// UnmarshalXML implementation on JobErrorDateTime to use errorDateTimeLayout -func (jdt *JobErrorDateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - var err error - jdt.Time, err = unmarshalTime(d, start, errorDateTimeLayout) - return err -} - -func unmarshalTime(d *xml.Decoder, start xml.StartElement, format string) (time.Time, error) { - var t time.Time - var content string - err := d.DecodeElement(&content, &start) - if err != nil { - return t, err - } - if content == "" { - return t, nil - } - if content == "0001-01-01T00:00:00Z" { - return t, nil - } - t, err = time.Parse(format, content) - if err != nil { - return t, err - } - t = t.UTC() - return t, nil -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/time_test.go b/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/time_test.go deleted file mode 100644 index fcb0c7ed..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/elementalconductor/time_test.go +++ /dev/null @@ -1,149 +0,0 @@ -package elementalconductor - -import ( - "encoding/xml" - "fmt" - "time" - - "gopkg.in/check.v1" -) - -func (s *S) TestDateTimeMarshalXML(c *check.C) { - var tests = []struct { - input time.Time - expected string - }{ - { - time.Time{}, - "", - }, - { - time.Date(2016, 12, 7, 21, 28, 43, 0, time.UTC), - "2016-12-07 21:28:43 +0000", - }, - } - for _, test := range tests { - var data struct { - XMLName xml.Name `xml:"item"` - Date DateTime `xml:"date,omitempty"` - } - data.Date.Time = test.input - b, err := xml.Marshal(data) - c.Check(err, check.IsNil) - c.Check(string(b), check.Equals, test.expected) - } -} - -func (s *S) TestDateTimeUnmarshalXML(c *check.C) { - var tests = []struct { - input string - expected time.Time - }{ - { - "2016-02-01 11:59:20 -0800", - time.Date(2016, time.February, 1, 19, 59, 20, 0, time.UTC), - }, - { - "2016-02-01 00:25:00 +0300", - time.Date(2016, time.January, 31, 21, 25, 0, 0, time.UTC), - }, - { - "", - time.Time{}, - }, - { - "0001-01-01T00:00:00Z", - time.Time{}, - }, - } - for _, test := range tests { - var output struct { - XMLName xml.Name `xml:"item"` - Date DateTime `xml:"date"` - } - input := fmt.Sprintf("%s", test.input) - err := xml.Unmarshal([]byte(input), &output) - c.Check(err, check.IsNil) - c.Check(output.Date.Time, check.DeepEquals, test.expected) - } -} - -func (s *S) TestDateTimeUnmarshalXMLInvalidFormat(c *check.C) { - var output struct { - XMLName xml.Name `xml:"item"` - Date DateTime `xml:"date"` - } - input := "2016-13-01 15:03:02 -0300" - err := xml.Unmarshal([]byte(input), &output) - c.Assert(err, check.NotNil) -} - -func (s *S) TestJobErrorDateTimeMarshalXML(c *check.C) { - var tests = []struct { - input time.Time - expected string - }{ - { - time.Time{}, - "", - }, - { - time.Date(2016, 12, 7, 21, 28, 43, 0, time.UTC), - "2016-12-07T21:28:43+00:00", - }, - } - for _, test := range tests { - var data struct { - XMLName xml.Name `xml:"item"` - Date JobErrorDateTime `xml:"date,omitempty"` - } - data.Date.Time = test.input - b, err := xml.Marshal(data) - c.Check(err, check.IsNil) - c.Check(string(b), check.Equals, test.expected) - } -} - -func (s *S) TestJobErrorDateTimeUnmarshalXML(c *check.C) { - var tests = []struct { - input string - expected time.Time - }{ - { - "2016-02-01T11:59:20-08:00", - time.Date(2016, time.February, 1, 19, 59, 20, 0, time.UTC), - }, - { - "2016-02-01T00:25:00+03:00", - time.Date(2016, time.January, 31, 21, 25, 0, 0, time.UTC), - }, - { - "", - time.Time{}, - }, - { - "0001-01-01T00:00:00Z", - time.Time{}, - }, - } - for _, test := range tests { - var output struct { - XMLName xml.Name `xml:"item"` - Date JobErrorDateTime `xml:"date"` - } - input := fmt.Sprintf("%s", test.input) - err := xml.Unmarshal([]byte(input), &output) - c.Check(err, check.IsNil) - c.Check(output.Date.Time, check.DeepEquals, test.expected) - } -} - -func (s *S) TestJobErrorDateTimeUnmarshalXMLInvalidFormat(c *check.C) { - var output struct { - XMLName xml.Name `xml:"item"` - Date JobErrorDateTime `xml:"date"` - } - input := "2016-13-01 15:03:02 -0300" - err := xml.Unmarshal([]byte(input), &output) - c.Assert(err, check.NotNil) -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/api_status.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/api_status.go deleted file mode 100644 index bb5d7d5a..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/api_status.go +++ /dev/null @@ -1,51 +0,0 @@ -package encodingcom - -import ( - "encoding/json" - "net" - "net/http" - "strings" - "time" -) - -// APIStatusResponse is the response returned by the APIStatus function. -// -// It describes the current status of the Encoding.com API. -type APIStatusResponse struct { - Status string `json:"status"` - StatusCode string `json:"status_code"` - Incident string `json:"incident"` -} - -// OK returns whether the given status represents no problem in the -// Encoding.com API. -func (s *APIStatusResponse) OK() bool { - return s.StatusCode == "ok" -} - -// APIStatus queries the current status of the Encoding.com API. -// -// The host parameter is optional, and when omitted, will default to -// "http://status.encoding.com". -// -// See http://goo.gl/3JKSxy for more details. -func APIStatus(endpoint string) (*APIStatusResponse, error) { - client := http.Client{ - Transport: &http.Transport{ - DialContext: (&net.Dialer{Timeout: time.Second}).DialContext, - ResponseHeaderTimeout: 2 * time.Second, - }, - } - url := strings.TrimRight(endpoint, "/") + "/status.php?format=json" - resp, err := client.Get(url) - if err != nil { - return nil, err - } - defer resp.Body.Close() - var apiResp APIStatusResponse - err = json.NewDecoder(resp.Body).Decode(&apiResp) - if err != nil { - return nil, err - } - return &apiResp, nil -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/api_status_test.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/api_status_test.go deleted file mode 100644 index 9f702d72..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/api_status_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package encodingcom - -import ( - "net/http" - "net/http/httptest" - - "gopkg.in/check.v1" -) - -func (s *S) TestAPIStatus(c *check.C) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(`{"status":"Encoding Queue Processing Delays","status_code":"queue_slow","incident":"Our encoding queue is processing slower than normal. Check back for updates."}`)) - })) - defer server.Close() - resp, err := APIStatus(server.URL) - c.Assert(err, check.IsNil) - c.Assert(*resp, check.DeepEquals, APIStatusResponse{ - Status: "Encoding Queue Processing Delays", - StatusCode: "queue_slow", - Incident: "Our encoding queue is processing slower than normal. Check back for updates.", - }) -} - -func (s *S) TestAPIStatusFailToConnect(c *check.C) { - _, err := APIStatus("http://192.0.2.13:8080") - c.Assert(err, check.NotNil) -} - -func (s *S) TestAPIStatusInvalidResponse(c *check.C) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(`{not a valid json}`)) - })) - defer server.Close() - _, err := APIStatus(server.URL) - c.Assert(err, check.NotNil) -} - -func (s *S) TestAPIStatusOK(c *check.C) { - var tests = []struct { - input string - want bool - }{ - {"ok", true}, - {"encoding_delay", false}, - {"api_out", false}, - {"maintenance", false}, - {"pc_queue_slow", false}, - } - for _, test := range tests { - status := APIStatusResponse{StatusCode: test.input} - got := status.OK() - c.Check(got, check.Equals, test.want) - } -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/client.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/client.go deleted file mode 100644 index 440ecd12..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/client.go +++ /dev/null @@ -1,405 +0,0 @@ -// Package encodingcom provides types and methods for interacting with the -// Encoding.com API. -// -// You can get more details on the API at http://api.encoding.com/. -package encodingcom - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strings" -) - -// Client is the basic type for interacting with the API. It provides methods -// matching the available actions in the API. -type Client struct { - Endpoint string - UserID string - UserKey string -} - -// NewClient creates a instance of the client type. -func NewClient(endpoint, userID, userKey string) (*Client, error) { - return &Client{Endpoint: endpoint, UserID: userID, UserKey: userKey}, nil -} - -// Response represents the generic response in the Encoding.com API. It doesn't -// include error information, as the client will smartly handle errors and -// return an instance of APIError when something goes wrong. -// -// See http://goo.gl/GBEn98 for more details. -type Response struct { - Message string `json:"message,omitempty"` -} - -func (c *Client) doMediaAction(mediaID string, action string) (*Response, error) { - var result map[string]*Response - err := c.do(&request{ - Action: action, - MediaID: mediaID, - }, &result) - if err != nil { - return nil, err - } - return result["response"], nil -} - -func (c *Client) do(r *request, out interface{}) error { - r.UserID = c.UserID - r.UserKey = c.UserKey - jsonRequest, err := json.Marshal(r) - if err != nil { - return err - } - rawMsg := json.RawMessage(jsonRequest) - m := map[string]interface{}{"query": &rawMsg} - reqData, err := json.Marshal(m) - if err != nil { - return err - } - params := url.Values{} - params.Add("json", string(reqData)) - req, err := http.NewRequest("POST", c.Endpoint, strings.NewReader(params.Encode())) - if err != nil { - return err - } - req.Header.Set("Content-Type", "application/x-www-form-urlencoded") - resp, err := http.DefaultClient.Do(req) - if err != nil { - return err - } - defer resp.Body.Close() - respData, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - var errRespWrapper map[string]*errorResponse - err = json.Unmarshal(respData, &errRespWrapper) - if err != nil { - return fmt.Errorf("Error unmarshaling response: %s", err.Error()) - } - if errResp := errRespWrapper["response"]; errResp.Errors.Error != "" { - return &APIError{ - Message: errResp.Message, - Errors: []string{errResp.Errors.Error}, - } - } - return json.Unmarshal(respData, out) -} - -// APIError represents an error returned by the Encoding.com API. -// -// See http://goo.gl/BzvXZt for more details. -type APIError struct { - Message string `json:",omitempty"` - Errors []string -} - -// Error converts the whole interlying information to a representative string. -// -// It encodes the list of errors in JSON format. -func (apiErr *APIError) Error() string { - data, _ := json.Marshal(apiErr) - return fmt.Sprintf("Error returned by the Encoding.com API: %s", data) -} - -type errorResponse struct { - Message string `json:"message,omitempty"` - Errors errorsJSON `json:"errors,omitempty"` -} - -type errorsJSON struct { - Error string `json:"error,omitempty"` -} - -type request struct { - UserID string `json:"userid"` - UserKey string `json:"userkey"` - Action string `json:"action"` - MediaID string `json:"mediaid,omitempty"` - TaskID string `json:"taskid,omitempty"` - Source []string `json:"source,omitempty"` - SplitScreen *SplitScreen `json:"split_screen,omitempty"` - Region string `json:"region,omitempty"` - NotifyFormat string `json:"notify_format,omitempty"` - NotifyURL string `json:"notify,omitempty"` - NotifyEncodingErrorsURL string `json:"notify_encoding_errors,omitempty"` - NotifyUploadURL string `json:"notify_upload,omitempty"` - Extended YesNoBoolean `json:"extended,omitempty"` - Type string `json:"type,omitempty"` - Name string `json:"name,omitempty"` - Format []Format `json:"format,omitempty"` -} - -// SplitScreen is the set of options for combining several sources to one split -// screen video. -// -// See http://goo.gl/EolKyv for more details. -type SplitScreen struct { - Columns int `json:"columns,string,omitempty"` - Rows int `json:"rows,string,omitempty"` - PaddingLeft int `json:"padding_left,string,omitempty"` - PaddingRight int `json:"padding_right,string,omitempty"` - PaddingBottom int `json:"padding_bottom,string,omitempty"` - PaddingTop int `json:"padding_top,string,omitempty"` -} - -// Format is the set of options for defining the output format when encoding -// new media files. -// -// See http://goo.gl/dcE1pF for more details. -type Format struct { - Output []string `json:"output,omitempty"` - NoiseReduction string `json:"noise_reduction,omitempty"` - OutputPreset string `json:"output_preset,omitempty"` - VideoCodec string `json:"video_codec,omitempty"` - AudioCodec string `json:"audio_codec,omitempty"` - Bitrate string `json:"bitrate,omitempty"` - AudioBitrate string `json:"audio_bitrate,omitempty"` - AudioChannelsNumber string `json:"audio_channels_number,omitempty"` - Framerate string `json:"framerate,omitempty"` - FramerateUpperThreshold string `json:"framerate_upper_threshold,omitempty"` - Size string `json:"size,omitempty"` - FadeIn string `json:"fade_in,omitempty"` - FadeOut string `json:"fade_out,omitempty"` - AudioSampleRate uint `json:"audio_sample_rate,string,omitempty"` - AudioVolume uint `json:"audio_volume,string,omitempty"` - CropLeft int `json:"crop_left,string,omitempty"` - CropTop int `json:"crop_top,string,omitempty"` - CropRight int `json:"crop_right,string,omitempty"` - CropBottom int `json:"crop_bottom,string,omitempty"` - SetAspectRatio string `json:"set_aspect_ratio,omitempty"` - RcInitOccupancy string `json:"rc_init_occupancy,omitempty"` - MinRate string `json:"minrate,omitempty"` - MaxRate string `json:"maxrate,omitempty"` - BufSize string `json:"bufsize,omitempty"` - Keyframe []string `json:"keyframe,omitempty"` - Start string `json:"start,omitempty"` - Duration string `json:"duration,omitempty"` - ForceKeyframes string `json:"force_keyframes,omitempty"` - Bframes int `json:"bframes,string,omitempty"` - Gop string `json:"gop,omitempty"` - Metadata *Metadata `json:"metadata,omitempty"` - Destination []string `json:"destination,omitempty"` - SegmentDuration uint `json:"segment_duration,omitempty"` - Logo *Logo `json:"logo,omitempty"` - Overlay []Overlay `json:"overlay,omitempty"` - TextOverlay []TextOverlay `json:"text_overlay,omitempty"` - VideoCodecParameters VideoCodecParameters `json:"video_codec_parameters,omitempty"` - Profile string `json:"profile,omitempty"` - Rotate string `json:"rotate,omitempty"` - SetRotate string `json:"set_rotate,omitempty"` - AudioSync string `json:"audio_sync,omitempty"` - VideoSync string `json:"video_sync,omitempty"` - ForceInterlaced string `json:"force_interlaced,omitempty"` - Stream []Stream `json:"stream,omitempty"` - AddMeta YesNoBoolean `json:"add_meta,omitempty"` - Hint YesNoBoolean `json:"hint,omitempty"` - KeepAspectRatio YesNoBoolean `json:"keep_aspect_ratio,omitempty"` - StripChapters YesNoBoolean `json:"strip_chapters,omitempty"` - TwoPass YesNoBoolean `json:"two_pass,omitempty"` - Turbo YesNoBoolean `json:"turbo,omitempty"` - TwinTurbo YesNoBoolean `json:"twin_turbo,omitempty"` - PackFiles *YesNoBoolean `json:"pack_files,omitempty"` -} - -// Stream is the set of options for defining Advanced HLS stream output -// when encoding new media files. -// -// See http://goo.gl/I7qRNo for more details. -type Stream struct { - AudioBitrate string `json:"audio_bitrate,omitempty"` - AudioChannelsNumber string `json:"audio_channels_number,omitempty"` - AudioCodec string `json:"audio_codec,omitempty"` - AudioSampleRate uint `json:"audio_sample_rate,string,omitempty"` - AudioVolume uint `json:"audio_volume,string,omitempty"` - Bitrate string `json:"bitrate,omitempty"` - Deinterlacing string `json:"deinterlacing,omitempty"` - DownmixMode string `json:"downmix_mode,omitempty"` - DurationPrecision uint `json:"duration_precision,string,omitempty"` - Encoder string `json:"encoder,omitempty"` - EncryptionMethod string `json:"encryption_method,omitempty"` - Framerate uint `json:"framerate,string,omitempty"` - Keyframe string `json:"keyframe,omitempty"` - MediaPath string `json:"media_path,omitempty"` - PixFormat string `json:"pix_format,omitempty"` - Profile string `json:"profile,omitempty"` - Rotate string `json:"rotate,omitempty"` - SetRotate string `json:"set_rotate,omitempty"` - Size string `json:"size,omitempty"` - StillImageSize string `json:"still_image_size,omitempty"` - StillImageTime string `json:"still_image_time,omitempty"` - SubPath string `json:"sub_path,omitempty"` - VeryFast string `json:"veryfast,omitempty"` - VideoCodec string `json:"video_codec,omitempty"` - VideoSync string `json:"video_sync,omitempty"` - VideoCodecParametersRaw interface{} `json:"video_codec_parameters,omitempty"` - AudioOnly YesNoBoolean `json:"audio_only,omitempty"` - AddIframeStream YesNoBoolean `json:"add_iframe_stream,omitempty"` - ByteRange YesNoBoolean `json:"byte_range,omitempty"` - Cbr YesNoBoolean `json:"cbr,omitempty"` - CopyNielsenMetadata YesNoBoolean `json:"copy_nielsen_metadata,omitempty"` - CopyTimestamps YesNoBoolean `json:"copy_timestamps,omitempty"` - Encryption YesNoBoolean `json:"encryption,omitempty"` - HardCbr YesNoBoolean `json:"hard_cbr,omitempty"` - Hint YesNoBoolean `json:"hint,omitempty"` - KeepAspectRatio YesNoBoolean `json:"keep_aspect_ratio,omitempty"` - MetadataCopy YesNoBoolean `json:"metadata_copy,omitempty"` - StillImage YesNoBoolean `json:"still_image,omitempty"` - StripChapters YesNoBoolean `json:"strip_chapters,omitempty"` - TwoPass YesNoBoolean `json:"two_pass,omitempty"` - VideoOnly YesNoBoolean `json:"video_only,omitempty"` -} - -// VideoCodecParameters function returns settings for H.264 video codec. -func (s Stream) VideoCodecParameters() VideoCodecParameters { - var params VideoCodecParameters - rawParameters, _ := json.Marshal(s.VideoCodecParametersRaw) - json.Unmarshal(rawParameters, ¶ms) - return params -} - -// VideoCodecParameters are settings for H.264 video codec. -// -// See http://goo.gl/8y7VSU for more details. -type VideoCodecParameters struct { - Coder string `json:"coder,omitempty"` - Flags string `json:"flags,omitempty"` - Flags2 string `json:"flags2,omitempty"` - Cmp string `json:"cmp,omitempty"` - Partitions string `json:"partitions,omitempty"` - MeMethod string `json:"me_method,omitempty"` - Subq string `json:"subq,omitempty"` - MeRange string `json:"me_range,omitempty"` - KeyIntMin string `json:"keyint_min,omitempty"` - ScThreshold string `json:"sc_threshold,omitempty"` - Iqfactor string `json:"i_qfactor,omitempty"` - Bstrategy string `json:"b_strategy,omitempty"` - Qcomp string `json:"qcomp,omitempty"` - Qmin string `json:"qmin,omitempty"` - Qmax string `json:"qmax,omitempty"` - Qdiff string `json:"qdiff,omitempty"` - DirectPred string `json:"directpred,omitempty"` - Level string `json:"level,omitempty"` - Vprofile string `json:"vprofile,omitempty"` -} - -// Logo is the set of options for watermarking media during encoding, allowing -// users to add a image to the final media. -// -// See http://goo.gl/4z2Q5S for more details. -type Logo struct { - LogoSourceURL string `json:"logo_source,omitempty"` - LogoX int `json:"logo_x,string,omitempty"` - LogoY int `json:"logo_y,string,omitempty"` - LogoMode int `json:"logo_mode,string,omitempty"` - LogoThreshold string `json:"logo_threshold,omitempty"` -} - -// Overlay is the set of options for adding a video overlay in the media being -// encoded. -// -// See http://goo.gl/Q6sjkR for more details. -type Overlay struct { - OverlaySource string `json:"overlay_source,omitempty"` - OverlayLeft string `json:"overlay_left,omitempty"` - OverlayRight string `json:"overlay_right,omitempty"` - OverlayTop string `json:"overlay_top,omitempty"` - OverlayBottom string `json:"overlay_bottom"` - Size string `json:"size,omitempty"` - OverlayStart float64 `json:"overlay_start,string,omitempty"` - OverlayDuration float64 `json:"overlay_duration,string,omitempty"` -} - -// TextOverlay is the set of options for adding a text overlay in the media -// being encoded. -// -// See http://goo.gl/gUKi5t for more details. -type TextOverlay struct { - Text []string `json:"text,omitempty"` - FontSourceURL string `json:"font_source,omitempty"` - FontSize uint `json:"font_size,string,omitempty"` - FontRotate int `json:"font_rotate,string,omitempty"` - FontColor string `json:"font_color,omitempty"` - AlignCenter ZeroOneBoolean `json:"align_center,omitempty"` - OverlayX int `json:"overlay_x,string,omitempty"` - OverlayY int `json:"overlay_y,string,omitempty"` - Size string `json:"size,omitempty"` - OverlayStart float64 `json:"overlay_start,string,omitempty"` - OverlayDuration float64 `json:"overlay_duration,string,omitempty"` -} - -// Metadata represents media metadata, as provided in the Format struct when -// encoding new media. -// -// See http://goo.gl/jNSio9 for more details. -type Metadata struct { - Title string `json:"title,omitempty"` - Copyright string `json:"copyright,omitempty"` - Author string `json:"author,omitempty"` - Description string `json:"description,omitempty"` - Album string `json:"album,omitempty"` -} - -// YesNoBoolean is a boolean that turns true into "yes" and false into "no" -// when encoded as JSON. -type YesNoBoolean bool - -// MarshalJSON is the method that ensures that YesNoBoolean satisfies the -// json.Marshaler interface. -func (b YesNoBoolean) MarshalJSON() ([]byte, error) { - return boolToBytes(bool(b), "yes", "no"), nil -} - -// UnmarshalJSON is the method that ensure that YesNoBoolean can be converted -// back from 1 or 0 to a boolean value. -func (b *YesNoBoolean) UnmarshalJSON(data []byte) error { - v, err := bytesToBool(data, "yes", "no") - if err != nil { - return err - } - *b = YesNoBoolean(v) - return nil -} - -// ZeroOneBoolean is a boolean that turns true into "1" and false into "0" when -// encoded as JSON. -type ZeroOneBoolean bool - -// MarshalJSON is the method that ensures that ZeroOneBoolean satisfies the -// json.Marshaler interface. -func (b ZeroOneBoolean) MarshalJSON() ([]byte, error) { - return boolToBytes(bool(b), "1", "0"), nil -} - -// UnmarshalJSON is the method that ensure that ZeroOneBoolean can be converted -// back from 1 or 0 to a boolean value. -func (b *ZeroOneBoolean) UnmarshalJSON(data []byte) error { - v, err := bytesToBool(data, "1", "0") - if err != nil { - return err - } - *b = ZeroOneBoolean(v) - return nil -} - -func boolToBytes(b bool, t, f string) []byte { - if b { - return []byte(`"` + t + `"`) - } - return []byte(`"` + f + `"`) -} - -func bytesToBool(data []byte, t, f string) (bool, error) { - switch string(data) { - case `"` + t + `"`: - return true, nil - case `"` + f + `"`: - return false, nil - default: - return false, fmt.Errorf("invalid value: %s", data) - } -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/client_test.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/client_test.go deleted file mode 100644 index 0185b37c..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/client_test.go +++ /dev/null @@ -1,194 +0,0 @@ -package encodingcom - -import ( - "encoding/json" - "net/http" - "net/http/httptest" - - "gopkg.in/check.v1" -) - -func (s *S) mockMediaResponseObject(message string, errors string) interface{} { - return map[string]interface{}{ - "response": map[string]interface{}{ - "message": message, - "errors": map[string]string{"error": errors}, - }, - } -} - -func (s *S) TestNewClient(c *check.C) { - expected := Client{ - Endpoint: "https://manage.encoding.com", - UserID: "myuser", - UserKey: "secret-key", - } - got, err := NewClient("https://manage.encoding.com", "myuser", "secret-key") - c.Assert(err, check.IsNil) - c.Assert(*got, check.DeepEquals, expected) -} - -func (s *S) TestYesNoBooleanMarshal(c *check.C) { - bTrue := YesNoBoolean(true) - bFalse := YesNoBoolean(false) - data, err := json.Marshal(bTrue) - c.Assert(err, check.IsNil) - c.Assert(string(data), check.Equals, `"yes"`) - data, err = json.Marshal(bFalse) - c.Assert(err, check.IsNil) - c.Assert(string(data), check.Equals, `"no"`) -} - -func (s *S) TestYesNoBooleanUnmarshal(c *check.C) { - data := []byte(`{"true":"yes", "false":"no"}`) - var m map[string]YesNoBoolean - err := json.Unmarshal(data, &m) - c.Assert(err, check.IsNil) - c.Assert(m, check.DeepEquals, map[string]YesNoBoolean{ - "true": YesNoBoolean(true), - "false": YesNoBoolean(false), - }) - - invalidData := []byte(`{"true":"true"}`) - err = json.Unmarshal(invalidData, &m) - c.Assert(err, check.NotNil) - c.Assert(err.Error(), check.Equals, `invalid value: "true"`) -} - -func (s *S) TestZeroOneBooleanMarshal(c *check.C) { - bTrue := ZeroOneBoolean(true) - bFalse := ZeroOneBoolean(false) - data, err := json.Marshal(bTrue) - c.Assert(err, check.IsNil) - c.Assert(string(data), check.Equals, `"1"`) - data, err = json.Marshal(bFalse) - c.Assert(err, check.IsNil) - c.Assert(string(data), check.Equals, `"0"`) -} - -func (s *S) TestZeroOneBooleanUnmarshal(c *check.C) { - data := []byte(`{"true":"1", "false":"0"}`) - var m map[string]ZeroOneBoolean - err := json.Unmarshal(data, &m) - c.Assert(err, check.IsNil) - c.Assert(m, check.DeepEquals, map[string]ZeroOneBoolean{ - "true": ZeroOneBoolean(true), - "false": ZeroOneBoolean(false), - }) - - invalidData := []byte(`{"true":"true"}`) - err = json.Unmarshal(invalidData, &m) - c.Assert(err, check.NotNil) - c.Assert(err.Error(), check.Equals, `invalid value: "true"`) -} - -func (s *S) TestDoMediaAction(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Deleted"}}`) - defer server.Close() - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - cancelMediaResponse, err := client.doMediaAction("12345", "CancelMedia") - c.Assert(err, check.IsNil) - c.Assert(cancelMediaResponse, check.DeepEquals, &Response{ - Message: "Deleted", - }) - req := <-requests - c.Assert(req.query["action"], check.Equals, "CancelMedia") -} - -func (s *S) TestDoMediaActionFailure(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Deleted", "errors": {"error": "something went wrong"}}}`) - defer server.Close() - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - cancelMediaResponse, err := client.doMediaAction("12345", "CancelMedia") - c.Assert(err, check.NotNil) - c.Assert(cancelMediaResponse, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "CancelMedia") -} - -func (s *S) TestDoMissingRequiredParameters(c *check.C) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - byteResponse, _ := json.Marshal(s.mockMediaResponseObject("", "Wrong user id or key!")) - w.Write(byteResponse) - })) - defer server.Close() - client := Client{Endpoint: server.URL} - err := client.do(&request{ - Action: "AddMedia", - MediaID: "123456", - Source: []string{"http://some.non.existent/video.mp4"}, - }, nil) - c.Assert(err, check.NotNil) - apiErr, ok := err.(*APIError) - c.Assert(ok, check.Equals, true) - c.Assert(apiErr.Message, check.Equals, "") - c.Assert(apiErr.Errors, check.DeepEquals, []string{"Wrong user id or key!"}) -} - -func (s *S) TestDoMediaResponse(c *check.C) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - byteResponse, _ := json.Marshal(s.mockMediaResponseObject("it worked!", "")) - w.Write(byteResponse) - })) - defer server.Close() - client := Client{Endpoint: server.URL} - var result map[string]*Response - err := client.do(&request{ - Action: "GetStatus", - MediaID: "123456", - }, &result) - c.Assert(err, check.IsNil) - c.Assert(result["response"].Message, check.Equals, "it worked!") -} - -func (s *S) TestDoRequiredParameters(c *check.C) { - var req *http.Request - var data string - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - req = r - data = req.FormValue("json") - w.Write([]byte(`{"response": {"status": "added"}}`)) - })) - defer server.Close() - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - var respObj map[string]interface{} - err := client.do(&request{Action: "GetStatus"}, &respObj) - c.Assert(err, check.IsNil) - c.Assert(req, check.NotNil) - c.Assert(req.Method, check.Equals, "POST") - c.Assert(req.URL.Path, check.Equals, "/") - c.Assert(req.Header.Get("Content-Type"), check.Equals, "application/x-www-form-urlencoded") - var m map[string]interface{} - err = json.Unmarshal([]byte(data), &m) - c.Assert(err, check.IsNil) - c.Assert(m, check.DeepEquals, map[string]interface{}{ - "query": map[string]interface{}{ - "userid": "myuser", - "userkey": "123", - "action": "GetStatus", - }, - }) - c.Assert(respObj, check.DeepEquals, map[string]interface{}{ - "response": map[string]interface{}{ - "status": "added", - }, - }) -} - -func (s *S) TestDoInvalidResponse(c *check.C) { - server, _ := s.startServer(`{invalid json}`) - defer server.Close() - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - var resp Response - err := client.do(&request{Action: "GetStatus"}, &resp) - c.Assert(err, check.NotNil) -} - -func (s *S) TestAPIErrorRepresentation(c *check.C) { - err := &APIError{ - Message: "something went wrong", - Errors: []string{"error 1", "error 2"}, - } - expectedMsg := `Error returned by the Encoding.com API: {"Message":"something went wrong","Errors":["error 1","error 2"]}` - c.Assert(err.Error(), check.Equals, expectedMsg) -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/data_test.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/data_test.go deleted file mode 100644 index ce273a82..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/data_test.go +++ /dev/null @@ -1,155 +0,0 @@ -package encodingcom - -const nonExtendedStatus = `{ - "response": { - "id": "abc123", - "userid": "myuser", - "sourcefile": "http://some.video/file.mp4", - "status": "Finished", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "downloaded": "2015-12-31 20:45:32", - "filesize": "379371262", - "processor": "AMAZON", - "region": "us-east-1", - "time_left": "21", - "progress": "100.0", - "format": { - "id": "f123", - "status": "Finished", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "output": "mp4", - "output_preset": [], - "destination": "s3://mynicebucket", - "destination_status": "Saved", - "protected_public_result": [], - "size": "0x1080", - "bitrate": "3500k", - "audio_bitrate": "192k", - "audio_sample_rate": "48000", - "audio_channels_number": "2", - "downmix_mode": "pl2", - "framerate": "30", - "framerate_upper_threshold": [], - "fade_in": [], - "fade_out": [], - "crop_top": [], - "crop_left": [], - "crop_right": [], - "crop_bottom": [], - "padd_top": [], - "padd_left": [], - "padd_right": [], - "padd_bottom": [], - "set_aspect_ratio": [], - "keep_aspect_ratio": "yes", - "video_codec": "libx264", - "profile": "high", - "VCodecParameters": [], - "video_codec_parameters": { - "coder": "1", - "flags": "+loop", - "flags2": "+bpyramid+wpred+mixed_refs+dct8x8-fastpskip", - "cmp": "+chroma", - "partitions": "+parti8x8+parti4x4+partp8x8+partb8x8", - "me_method": "umh", - "subq": "7", - "me_range": "16", - "bf": "16", - "keyint_min": "25", - "sc_threshold": "40", - "i_qfactor": "0.71", - "b_strategy": "1", - "qcomp": "0.6", - "qmin": "10", - "qmax": "51", - "qdiff": "4", - "directpred": "1", - "level": "30", - "refs": "4", - "psy": "0" - }, - "audio_codec": "dolby_aac", - "two_pass": "no", - "turbo": "no", - "twin_turbo": "no", - "cbr": "no", - "hard_cbr": "no", - "minrate": [], - "maxrate": [], - "bufsize": [], - "audio_minrate": [], - "audio_maxrate": [], - "audio_bufsize": [], - "rc_init_occupancy": [], - "deinterlacing": "auto", - "video_sync": "old", - "keyframe": "300", - "start": [], - "finish": [], - "duration": [], - "audio_volume": "100", - "audio_normalization": [], - "dmg_alerts": [], - "loudness_mode": [], - "input_speech": [], - "clipmode": [], - "prolimiter_max_peak": [], - "input_dialnorm": [], - "adjust_gain_for_dialnorm": [], - "dialnorm_threshold": [], - "dc_repair": [], - "phase_repair": [], - "dmix_center_level": [], - "dmix_center_level_ltrt": [], - "dmix_center_level_loro": [], - "dmix_surround_level": [], - "dmix_surround_level_ltrt": [], - "dmix_surround_level_loro": [], - "audio_sync": [], - "rotate": "def", - "noise_reduction": [], - "two_pass_decoding": [], - "force_keyframes": [], - "metadata_copy": "no", - "strip_chapters": "no", - "pix_format": "yuv420p", - "pan": [], - "encoder": "v1", - "burnin_timecode": [], - "copy_timestamps": "yes", - "encryption": "no", - "encryption_method": "aes-128-cbc", - "encryption_key": [], - "encryption_key_file": [], - "encryption_iv": [], - "encryption_password": [], - "slices": [], - "audio_stream": [], - "file_extension": "mp4", - "ftyp": [], - "hint": "no", - "extends": [], - "set_rotate": "0", - "copy_nielsen_metadata": "no", - "nielsen_breakout_code": [], - "nielsen_distributor_id": [], - "drm": "no", - "drm-content-id": [], - "drm-common-key": [], - "drm-license-server-url": [], - "drm-license-server-cert": [], - "drm-transport-cert": [], - "drm-packager-credential": [], - "drm-credential-pwd": [], - "drm-policy-file": [], - "convertedsize": "78544430", - "queued": "", - "converttime": "0" - }, - "queue_time": "0" - } -}` diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media.go deleted file mode 100644 index 8a69ec34..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media.go +++ /dev/null @@ -1,151 +0,0 @@ -package encodingcom - -import "time" - -// dateTimeLayout is the time layout used on Media items -const dateTimeLayout = "2006-01-02 15:04:05" - -// MediaDateTime is a custom time struct to be used on Media items -type MediaDateTime struct { - time.Time -} - -// UnmarshalJSON implementation on MediaDateTime to use dateTimeLayout -func (mdt *MediaDateTime) UnmarshalJSON(b []byte) (err error) { - if b[0] == '"' && b[len(b)-1] == '"' { - b = b[1 : len(b)-1] - } - if string(b) == "0000-00-00 00:00:00" { - mdt.Time = time.Time{} - return nil - } - mdt.Time, err = time.Parse(dateTimeLayout, string(b)) - return err -} - -// AddMediaResponse represents the response returned by the AddMedia action. -// -// See http://goo.gl/Aqg8lc for more details. -type AddMediaResponse struct { - Message string `json:"message,omitempty"` - MediaID string `json:"mediaid,omitempty"` -} - -// ListMediaResponse represents the response returned by the GetMediaList action. -// -// See http://goo.gl/xhVV6v for more details. -type ListMediaResponse struct { - Media []ListMediaResponseItem `json:"media,omitempty"` -} - -// ListMediaResponseItem represents each individual item returned by the GetMediaList action. -// -// See ListMediaResponse -type ListMediaResponseItem struct { - MediaFile string `json:"mediafile,omitempty"` - MediaID string `json:"mediaid,omitempty"` - MediaStatus string `json:"mediastatus,omitempty"` - CreateDate MediaDateTime `json:"createdate,string,omitempty"` - StartDate MediaDateTime `json:"startdate,string,omitempty"` - FinishDate MediaDateTime `json:"finishdate,string,omitempty"` -} - -// AddMedia adds a new media to user's queue. -// -// Format specifies details on how the source files are going to be encoded. -// -// See http://goo.gl/whvHwJ for more details on the source file formatting. -func (c *Client) AddMedia(source []string, format []Format, region string) (*AddMediaResponse, error) { - var result map[string]*AddMediaResponse - req := request{ - Action: "AddMedia", - Format: format, - Source: source, - Region: region, - } - err := c.do(&req, &result) - if err != nil { - return nil, err - } - return result["response"], nil -} - -// StopMedia stops an existing media on user's queue based on the mediaID. -func (c *Client) StopMedia(mediaID string) (*Response, error) { - return c.doMediaAction(mediaID, "StopMedia") -} - -// CancelMedia deletes an existing media on user's queue based on the mediaID. -func (c *Client) CancelMedia(mediaID string) (*Response, error) { - return c.doMediaAction(mediaID, "CancelMedia") -} - -// RestartMedia restart the entire job of an existing media on user's queue based on the mediaID. -// When withErrors enabled it only retry tasks ended with error and not the entire job. -func (c *Client) RestartMedia(mediaID string, withErrors bool) (*Response, error) { - action := "RestartMedia" - if withErrors { - action = "RestartMediaErrors" - } - return c.doMediaAction(mediaID, action) -} - -// RestartMediaTask restart a specific task on a job. -func (c *Client) RestartMediaTask(mediaID string, taskID string) (*Response, error) { - var result map[string]*Response - err := c.do(&request{ - Action: "RestartMediaTask", - MediaID: mediaID, - TaskID: taskID, - }, &result) - if err != nil { - return nil, err - } - return result["response"], nil -} - -// ListMedia (GetMediaList action) returns a list of the user's media in the queue. -func (c *Client) ListMedia() (*ListMediaResponse, error) { - var result map[string]*ListMediaResponse - err := c.do(&request{Action: "GetMediaList"}, &result) - if err != nil { - return nil, err - } - return result["response"], nil -} - -// MediaInfo is the result of the GetMediaInfo method. -// -// See http://goo.gl/OTX0Ua for more details. -type MediaInfo struct { - Duration time.Duration `json:"duration,string"` - Bitrate string `json:"bitrate"` - VideoCodec string `json:"video_codec"` - VideoBitrate string `json:"video_bitrate"` - Framerate string `json:"frame_rate"` - Size string `json:"size"` - PixelAspectRatio string `json:"pixel_aspect_ratio"` - DisplayAspectRatio string `json:"display_aspect_ratio"` - AudioCodec string `json:"audio_codec"` - AudioBitrate string `json:"audio_bitrate"` - AudioSampleRate uint `json:"audio_sample_rate,string"` - AudioChannels string `json:"audio_channels"` - Rotation uint `json:"rotation,string"` -} - -type mediaInfo struct { - MediaInfo - Duration float64 `json:"duration,string"` -} - -// GetMediaInfo returns video parameters of the specified media when available. -func (c *Client) GetMediaInfo(mediaID string) (*MediaInfo, error) { - var result map[string]*mediaInfo - err := c.do(&request{Action: "GetMediaInfo", MediaID: mediaID}, &result) - if err != nil { - return nil, err - } - info := result["response"].MediaInfo - info.Duration = time.Duration(result["response"].Duration * float64(time.Second)) - return &info, nil -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_status.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_status.go deleted file mode 100644 index ed14b04f..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_status.go +++ /dev/null @@ -1,220 +0,0 @@ -package encodingcom - -import ( - "encoding/json" - "errors" - "strings" - "time" -) - -// StatusResponse is the result of the GetStatus method. -// -// See http://goo.gl/NDsN8h for more details. -type StatusResponse struct { - MediaID string - UserID string - SourceFile string - MediaStatus string - PreviousMediaStatus string - NotifyURL string - CreateDate time.Time - StartDate time.Time - FinishDate time.Time - DownloadDate time.Time - UploadDate time.Time - TimeLeft string - Progress float64 - TimeLeftCurrentJob string - ProgressCurrentJob float64 - Formats []FormatStatus -} - -// FormatStatus is the status of each formatting input for a given MediaID. -// -// It is part of the StatusResponse type. -type FormatStatus struct { - ID string - Status string - CreateDate time.Time - StartDate time.Time - FinishDate time.Time - Description string - S3Destination string - CFDestination string - Size string - Bitrate string - Output string - VideoCodec string - AudioCodec string - Destinations []DestinationStatus - Stream []Stream - FileSize string -} - -// DestinationStatus represents the status of a given destination. -type DestinationStatus struct { - Name string - Status string -} - -// GetStatus returns the status of the given media ids, it returns an slice of -// StatusResponse, the size of the result slice matches the size of input -// slice. -func (c *Client) GetStatus(mediaIDs []string, extended bool) ([]StatusResponse, error) { - if len(mediaIDs) == 0 { - return nil, errors.New("please provide at least one media id") - } - - var m map[string]map[string]interface{} - err := c.do(&request{ - Action: "GetStatus", - MediaID: strings.Join(mediaIDs, ","), - Extended: YesNoBoolean(extended), - }, &m) - if err != nil { - return nil, err - } - - var apiStatus []statusJSON - var rawData interface{} - if extended { - rawData = m["response"]["job"] - } else { - rawData = m["response"] - } - rawBytes, _ := json.Marshal(rawData) - if _, ok := rawData.([]interface{}); ok { - json.Unmarshal(rawBytes, &apiStatus) - } else { - var item statusJSON - json.Unmarshal(rawBytes, &item) - apiStatus = append(apiStatus, item) - } - - statusResponse := make([]StatusResponse, len(apiStatus)) - for i, status := range apiStatus { - statusResponse[i] = status.toStruct() - } - return statusResponse, nil -} - -type statusJSON struct { - MediaID string `json:"id"` - UserID string `json:"userid"` - SourceFile string `json:"sourcefile"` - MediaStatus string `json:"status"` - PreviousMediaStatus string `json:"prevstatus"` - NotifyURL string `json:"notifyurl"` - CreateDate MediaDateTime `json:"created"` - StartDate MediaDateTime `json:"started"` - FinishDate MediaDateTime `json:"finished"` - DownloadDate MediaDateTime `json:"downloaded"` - UploadDate MediaDateTime `json:"uploaded"` - TimeLeft string `json:"time_left"` - Progress float64 `json:"progress,string"` - TimeLeftCurrentJob string `json:"time_left_current"` - ProgressCurrentJob float64 `json:"progress_current,string"` - Formats interface{} `json:"format"` -} - -func (s *statusJSON) toStruct() StatusResponse { - resp := StatusResponse{ - MediaID: s.MediaID, - UserID: s.UserID, - SourceFile: s.SourceFile, - MediaStatus: s.MediaStatus, - PreviousMediaStatus: s.PreviousMediaStatus, - NotifyURL: s.NotifyURL, - CreateDate: s.CreateDate.Time, - StartDate: s.StartDate.Time, - FinishDate: s.FinishDate.Time, - DownloadDate: s.DownloadDate.Time, - UploadDate: s.UploadDate.Time, - TimeLeft: s.TimeLeft, - Progress: s.Progress, - TimeLeftCurrentJob: s.TimeLeftCurrentJob, - ProgressCurrentJob: s.ProgressCurrentJob, - } - - // Yes, Encoding.com API is nuts, and when there's a single item in the - // list, it returns an object instead of a list with a single item, so - // we marshal it back, and then unmarshal in the proper type. The same - // happens in the internal list of destinations. - var formats []formatStatusJSON - data, _ := json.Marshal(s.Formats) - if _, ok := s.Formats.([]interface{}); ok { - json.Unmarshal(data, &formats) - } else { - var formatStatus formatStatusJSON - json.Unmarshal(data, &formatStatus) - formats = append(formats, formatStatus) - } - - resp.Formats = make([]FormatStatus, len(formats)) - for i, formatStatus := range formats { - format := FormatStatus{ - ID: formatStatus.ID, - Status: formatStatus.Status, - CreateDate: formatStatus.CreateDate.Time, - StartDate: formatStatus.StartDate.Time, - FinishDate: formatStatus.FinishDate.Time, - Description: formatStatus.Description, - S3Destination: formatStatus.S3Destination, - CFDestination: formatStatus.CFDestination, - Size: formatStatus.Size, - Bitrate: formatStatus.Bitrate, - AudioCodec: formatStatus.AudioCodec, - Output: formatStatus.Output, - VideoCodec: formatStatus.VideoCodec, - Stream: formatStatus.Stream, - FileSize: formatStatus.FileSize, - } - - switch dest := formatStatus.Destinations.(type) { - case string: - destinationStatus := DestinationStatus{Name: dest} - if statusStr, ok := formatStatus.DestinationsStatus.(string); ok { - destinationStatus.Status = statusStr - } - format.Destinations = append(format.Destinations, destinationStatus) - case []interface{}: - destStats, ok := formatStatus.DestinationsStatus.([]interface{}) - if !ok { - destStats = make([]interface{}, len(dest)) - } - format.Destinations = make([]DestinationStatus, len(dest)) - for i, d := range dest { - format.Destinations[i] = DestinationStatus{} - if destName, ok := d.(string); ok { - format.Destinations[i].Name = destName - } - if statusStr, ok := destStats[i].(string); ok { - format.Destinations[i].Status = statusStr - } - } - } - - resp.Formats[i] = format - } - return resp -} - -type formatStatusJSON struct { - ID string `json:"id"` - Status string `json:"status"` - CreateDate MediaDateTime `json:"created"` - StartDate MediaDateTime `json:"started"` - FinishDate MediaDateTime `json:"finished"` - Description string `json:"description"` - S3Destination string `json:"s3_destination"` - CFDestination string `json:"cf_destination"` - Destinations interface{} `json:"destination"` - DestinationsStatus interface{} `json:"destination_status"` - Size string `json:"size"` - Bitrate string `json:"bitrate"` - AudioCodec string `json:"audio_codec"` - VideoCodec string `json:"video_codec"` - Output string `json:"output"` - Stream []Stream `json:"stream"` - FileSize string `json:"convertedsize"` -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_status_test.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_status_test.go deleted file mode 100644 index 084d0bb4..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_status_test.go +++ /dev/null @@ -1,414 +0,0 @@ -package encodingcom - -import ( - "time" - - "gopkg.in/check.v1" -) - -func (s *S) TestGetStatusSingle(c *check.C) { - server, requests := s.startServer(` -{ - "response": { - "job": { - "id": "abc123", - "userid": "myuser", - "sourcefile": "http://some.video/file.mp4", - "status": "Finished", - "notifyurl": "http://ping.me/please", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "prevstatus": "Saving", - "downloaded": "2015-12-31 20:45:32", - "uploaded": "2015-12-31 20:59:54", - "time_left": "0", - "progress": "100", - "time_left_current": "0", - "progress_current": "100.0", - "format": { - "id": "f123", - "status": "Finished", - "description": "Something", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4", - "cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4", - "convertedsize": "65723", - "destination": "s3://mynicebucket", - "destination_status": "Saved" - } - } - } -}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - status, err := client.GetStatus([]string{"abc123"}, true) - c.Assert(err, check.IsNil) - - expectedCreateDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:30") - expectedStartDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:34") - expectedFinishDate, _ := time.Parse(dateTimeLayout, "2015-12-31 21:00:03") - expectedDownloadDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:32") - expectedUploadDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:59:54") - expected := []StatusResponse{ - { - MediaID: "abc123", - UserID: "myuser", - SourceFile: "http://some.video/file.mp4", - MediaStatus: "Finished", - PreviousMediaStatus: "Saving", - NotifyURL: "http://ping.me/please", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - DownloadDate: expectedDownloadDate, - UploadDate: expectedUploadDate, - TimeLeft: "0", - Progress: 100.0, - TimeLeftCurrentJob: "0", - ProgressCurrentJob: 100.0, - Formats: []FormatStatus{ - { - ID: "f123", - Status: "Finished", - Description: "Something", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4", - CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4", - FileSize: "65723", - Destinations: []DestinationStatus{{Name: "s3://mynicebucket", Status: "Saved"}}, - }, - }, - }, - } - c.Assert(status, check.DeepEquals, expected) - - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetStatus") - c.Assert(req.query["mediaid"], check.Equals, "abc123") - c.Assert(req.query["extended"], check.Equals, "yes") -} - -func (s *S) TestGetStatusMultiple(c *check.C) { - server, requests := s.startServer(` -{ - "response": { - "job": [ - { - "id": "abc123", - "userid": "myuser", - "sourcefile": "http://some.video/file.mp4", - "status": "Finished", - "notifyurl": "http://ping.me/please", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "prevstatus": "Saving", - "downloaded": "2015-12-31 20:45:32", - "uploaded": "2015-12-31 20:59:54", - "time_left": "0", - "progress": "100", - "time_left_current": "0", - "progress_current": "100.0", - "format": [ - { - "id": "f123", - "status": "Finished", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4", - "cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4", - "convertedsize": "65724", - "destination": [ - null, - "s3://myunclebucket/file.mp4" - ], - "destination_status": [ - null, - "Saved" - ] - }, - { - "id": "f124", - "status": "Finished", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4", - "cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4", - "convertedsize": "65725", - "destination": [ - "s3://mynicebucket/file.mp4", - "s3://myunclebucket/file.mp4" - ], - "destination_status": null - } - ] - }, - { - "id": "abc124", - "userid": "myuser", - "sourcefile": "http://some.video/file.mp4", - "status": "Finished", - "notifyurl": "http://ping.me/please", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "prevstatus": "Saving", - "downloaded": "2015-12-31 20:45:32", - "uploaded": "2015-12-31 20:59:54", - "time_left": "0", - "progress": "100", - "time_left_current": "0", - "progress_current": "100.0", - "format": { - "id": "f123", - "status": "Finished", - "created": "2015-12-31 20:45:30", - "started": "2015-12-31 20:45:34", - "finished": "2015-12-31 21:00:03", - "s3_destination": "https://s3.amazonaws.com/not-really/valid.mp4", - "cf_destination": "https://blablabla.cloudfront.net/not-valid.mp4", - "convertedsize": "65726", - "destination": [ - "s3://mynicebucket/file.mp4", - "s3://myunclebucket/file.mp4" - ], - "destination_status": [ - "Saved", - "Saved" - ] - } - } - ] - } -}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - status, err := client.GetStatus([]string{"abc123", "abc124"}, true) - c.Assert(err, check.IsNil) - - expectedCreateDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:30") - expectedStartDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:34") - expectedFinishDate, _ := time.Parse(dateTimeLayout, "2015-12-31 21:00:03") - expectedDownloadDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:32") - expectedUploadDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:59:54") - expected := []StatusResponse{ - { - MediaID: "abc123", - UserID: "myuser", - SourceFile: "http://some.video/file.mp4", - MediaStatus: "Finished", - PreviousMediaStatus: "Saving", - NotifyURL: "http://ping.me/please", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - DownloadDate: expectedDownloadDate, - UploadDate: expectedUploadDate, - TimeLeft: "0", - Progress: 100.0, - TimeLeftCurrentJob: "0", - ProgressCurrentJob: 100.0, - Formats: []FormatStatus{ - { - ID: "f123", - Status: "Finished", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4", - CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4", - FileSize: "65724", - Destinations: []DestinationStatus{ - {Name: "", Status: ""}, - {Name: "s3://myunclebucket/file.mp4", Status: "Saved"}, - }, - }, - { - ID: "f124", - Status: "Finished", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4", - CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4", - FileSize: "65725", - Destinations: []DestinationStatus{ - {Name: "s3://mynicebucket/file.mp4", Status: ""}, - {Name: "s3://myunclebucket/file.mp4", Status: ""}, - }, - }, - }, - }, - { - MediaID: "abc124", - UserID: "myuser", - SourceFile: "http://some.video/file.mp4", - MediaStatus: "Finished", - PreviousMediaStatus: "Saving", - NotifyURL: "http://ping.me/please", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - DownloadDate: expectedDownloadDate, - UploadDate: expectedUploadDate, - TimeLeft: "0", - Progress: 100.0, - TimeLeftCurrentJob: "0", - ProgressCurrentJob: 100.0, - Formats: []FormatStatus{ - { - ID: "f123", - Status: "Finished", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - S3Destination: "https://s3.amazonaws.com/not-really/valid.mp4", - CFDestination: "https://blablabla.cloudfront.net/not-valid.mp4", - FileSize: "65726", - Destinations: []DestinationStatus{ - {Name: "s3://mynicebucket/file.mp4", Status: "Saved"}, - {Name: "s3://myunclebucket/file.mp4", Status: "Saved"}, - }, - }, - }, - }, - } - c.Assert(status, check.DeepEquals, expected) - - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetStatus") - c.Assert(req.query["mediaid"], check.Equals, "abc123,abc124") - c.Assert(req.query["extended"], check.Equals, "yes") -} - -// Some data are only available when extended=no -func (s *S) TestGetStatusNotExtended(c *check.C) { - server, requests := s.startServer(nonExtendedStatus) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - status, err := client.GetStatus([]string{"abc123"}, false) - c.Assert(err, check.IsNil) - - expectedCreateDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:30") - expectedStartDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:34") - expectedFinishDate, _ := time.Parse(dateTimeLayout, "2015-12-31 21:00:03") - expectedDownloadDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:32") - expected := []StatusResponse{ - { - MediaID: "abc123", - UserID: "myuser", - SourceFile: "http://some.video/file.mp4", - MediaStatus: "Finished", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - DownloadDate: expectedDownloadDate, - TimeLeft: "21", - Progress: 100.0, - Formats: []FormatStatus{ - { - ID: "f123", - Status: "Finished", - CreateDate: expectedCreateDate, - StartDate: expectedStartDate, - FinishDate: expectedFinishDate, - Destinations: []DestinationStatus{{Name: "s3://mynicebucket", Status: "Saved"}}, - Size: "0x1080", - Bitrate: "3500k", - Output: "mp4", - VideoCodec: "libx264", - AudioCodec: "dolby_aac", - FileSize: "78544430", - }, - }, - }, - } - c.Assert(status, check.DeepEquals, expected) - - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetStatus") - c.Assert(req.query["mediaid"], check.Equals, "abc123") - c.Assert(req.query["extended"], check.IsNil) -} - -func (s *S) TestGetStatusZeroTime(c *check.C) { - server, _ := s.startServer(` -{ - "response": { - "job": { - "id":"abc123", - "userid":"myuser", - "sourcefile":"http://some.file/wait-wat", - "status":"Error", - "created":"2016-01-29 19:32:32", - "started":"2016-01-29 19:32:32", - "finished":"0000-00-00 00:00:00", - "downloaded":"0000-00-00 00:00:00", - "description":"Download error: The requested URL returned error: 403 Forbidden", - "processor":"AMAZON", - "region":"oak-private-clive", - "time_left":"50", - "progress":"50.0", - "time_left_current":"0", - "progress_current":"0.0", - "format":{ - "id":"164478401", - "status":"New", - "created":"2016-01-29 19:32:32", - "started":"0000-00-00 00:00:00", - "finished":"0000-00-00 00:00:00", - "destination":"http://s4.amazonaws.com/future", - "destination_status":"Open", - "convertedsize":"0", - "queued":"0000-00-00 00:00:00", - "converttime":"0", - "time_left":"40", - "progress":"0.0", - "time_left_current":"0", - "progress_current":"0.0" - }, - "queue_time":"0" - } - } -}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - status, err := client.GetStatus([]string{"abc123"}, true) - c.Assert(err, check.IsNil) - c.Assert(status, check.HasLen, 1) - - expectedCreateDate, _ := time.Parse(dateTimeLayout, "2016-01-29 19:32:32") - c.Assert(status[0].MediaID, check.Equals, "abc123") - c.Assert(status[0].CreateDate, check.DeepEquals, expectedCreateDate) - c.Assert(status[0].FinishDate.IsZero(), check.Equals, true) - c.Assert(status[0].DownloadDate.IsZero(), check.Equals, true) -} - -func (s *S) TestGetStatusNoMedia(c *check.C) { - var client Client - status, err := client.GetStatus(nil, true) - c.Assert(err, check.NotNil) - c.Assert(err.Error(), check.Equals, "please provide at least one media id") - c.Assert(status, check.HasLen, 0) -} - -func (s *S) TestGetStatusError(c *check.C) { - server, _ := s.startServer(`{"response": {"message": "", "errors": {"error": "wait what?"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.GetStatus([]string{"some-media"}, true) - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_test.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_test.go deleted file mode 100644 index 7be6d97a..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/media_test.go +++ /dev/null @@ -1,277 +0,0 @@ -package encodingcom - -import ( - "time" - - "gopkg.in/check.v1" -) - -func (s *S) TestAddMedia(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Added", "MediaID": "1234567"}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - format := Format{ - Output: []string{"http://another.non.existent/video.mp4"}, - VideoCodec: "x264", - AudioCodec: "aac", - Bitrate: "900k", - AudioBitrate: "64k", - } - addMediaResponse, err := client.AddMedia([]string{"http://another.non.existent/video.mov"}, - []Format{format}, "us-east-1") - - c.Assert(err, check.IsNil) - c.Assert(addMediaResponse, check.DeepEquals, &AddMediaResponse{ - Message: "Added", - MediaID: "1234567", - }) - req := <-requests - c.Assert(req.query["action"], check.Equals, "AddMedia") -} - -func (s *S) TestAddMediaError(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Added", "errors": {"error": "something went wrong"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - format := Format{ - Output: []string{"http://another.non.existent/video.mp4"}, - VideoCodec: "x264", - AudioCodec: "aac", - Bitrate: "900k", - AudioBitrate: "64k", - } - addMediaResponse, err := client.AddMedia([]string{"http://another.non.existent/video.mov"}, - []Format{format}, "us-east-1") - c.Assert(err, check.NotNil) - c.Assert(addMediaResponse, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "AddMedia") -} - -func (s *S) TestStopMedia(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Stopped"}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.StopMedia("some-media") - c.Assert(err, check.IsNil) - c.Assert(resp, check.DeepEquals, &Response{Message: "Stopped"}) - req := <-requests - c.Assert(req.query["action"], check.Equals, "StopMedia") - c.Assert(req.query["mediaid"], check.Equals, "some-media") -} - -func (s *S) TestStopMediaError(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "failed", "errors": {"error": "something went wrong"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.StopMedia("some-media") - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "StopMedia") -} - -func (s *S) TestCancelMedia(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Canceled"}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.CancelMedia("some-media") - c.Assert(err, check.IsNil) - c.Assert(resp, check.DeepEquals, &Response{Message: "Canceled"}) - req := <-requests - c.Assert(req.query["action"], check.Equals, "CancelMedia") - c.Assert(req.query["mediaid"], check.Equals, "some-media") -} - -func (s *S) TestCancelMediaError(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "failed", "errors": {"error": "something went wrong"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.CancelMedia("some-media") - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "CancelMedia") -} - -func (s *S) TestRestartMedia(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Restarted"}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.RestartMedia("some-media", false) - c.Assert(err, check.IsNil) - c.Assert(resp, check.DeepEquals, &Response{Message: "Restarted"}) - req := <-requests - c.Assert(req.query["action"], check.Equals, "RestartMedia") - c.Assert(req.query["mediaid"], check.Equals, "some-media") -} - -func (s *S) TestRestartMediaWithErrors(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Restarted"}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.RestartMedia("some-media", true) - c.Assert(err, check.IsNil) - c.Assert(resp, check.DeepEquals, &Response{Message: "Restarted"}) - req := <-requests - c.Assert(req.query["action"], check.Equals, "RestartMediaErrors") - c.Assert(req.query["mediaid"], check.Equals, "some-media") -} - -func (s *S) TestRestartMediaError(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "failed", "errors": {"error": "something went wrong"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.RestartMedia("some-media", false) - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "RestartMedia") -} - -func (s *S) TestRestartMediaTask(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Task restarted"}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.RestartMediaTask("some-media", "some-task") - c.Assert(err, check.IsNil) - c.Assert(resp, check.DeepEquals, &Response{Message: "Task restarted"}) - req := <-requests - c.Assert(req.query["action"], check.Equals, "RestartMediaTask") - c.Assert(req.query["mediaid"], check.Equals, "some-media") - c.Assert(req.query["taskid"], check.Equals, "some-task") -} - -func (s *S) TestRestartMediaTaskError(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "Failed to restart", "errors": {"error": "something went really bad"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.RestartMediaTask("some-media", "some-task") - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "RestartMediaTask") -} - -func (s *S) TestListMedia(c *check.C) { - server, requests := s.startServer(` -{ - "response":{ - "media":[ - { - "mediafile":"http://another.non.existent/video.mp4", - "mediaid":"1234567", - "mediastatus":"Finished", - "createdate":"2015-12-31 20:45:30", - "startdate":"2015-12-31 20:45:50", - "finishdate":"2015-12-31 20:48:54" - } - ] - } -}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - listMediaResponse, err := client.ListMedia() - c.Assert(err, check.IsNil) - - mockCreateDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:30") - mockStartDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:45:50") - mockFinishDate, _ := time.Parse(dateTimeLayout, "2015-12-31 20:48:54") - - c.Assert(listMediaResponse, check.DeepEquals, &ListMediaResponse{ - Media: []ListMediaResponseItem{ - { - "http://another.non.existent/video.mp4", - "1234567", - "Finished", - MediaDateTime{mockCreateDate}, - MediaDateTime{mockStartDate}, - MediaDateTime{mockFinishDate}, - }, - }, - }) - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetMediaList") -} - -func (s *S) TestListMediaError(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "", "errors": {"error": "can't list"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.ListMedia() - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetMediaList") -} - -func (s *S) TestGetMediaInfo(c *check.C) { - server, requests := s.startServer(` -{ - "response": { - "bitrate": "1807k", - "duration": "6464.83", - "audio_bitrate": "128k", - "video_codec": "mpeg4", - "video_bitrate": "1679k", - "frame_rate": "23.98", - "size": "640x352", - "pixel_aspect_ratio": "1:1", - "display_aspect_ratio": "20:11", - "audio_codec": "ac3", - "audio_sample_rate": "48000", - "audio_channels": "2", - "rotation":"90" - } -}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - mediaInfo, err := client.GetMediaInfo("m-123") - c.Assert(err, check.IsNil) - - c.Assert(mediaInfo, check.DeepEquals, &MediaInfo{ - Bitrate: "1807k", - Duration: 6464*time.Second + time.Duration(0.83*float64(time.Second)), - VideoCodec: "mpeg4", - VideoBitrate: "1679k", - Framerate: "23.98", - Size: "640x352", - PixelAspectRatio: "1:1", - DisplayAspectRatio: "20:11", - AudioCodec: "ac3", - AudioSampleRate: uint(48000), - AudioChannels: "2", - AudioBitrate: "128k", - Rotation: 90, - }) - - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetMediaInfo") - c.Assert(req.query["mediaid"], check.Equals, "m-123") -} - -func (s *S) TestGetMediaInfoError(c *check.C) { - server, requests := s.startServer(`{"response": {"message": "", "errors": {"error": "wait what?"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.GetMediaInfo("some-media") - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetMediaInfo") -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/preset.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/preset.go deleted file mode 100644 index 8885be94..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/preset.go +++ /dev/null @@ -1,168 +0,0 @@ -package encodingcom - -import "encoding/json" - -const ( - // AllPresets is used to retrieve all presets in the response of - // ListPresets or GetPreset methods. - AllPresets = PresetType("all") - - // UserPresets is used to retrieve only user-created presets in the - // response of ListPresets or GetPreset methods. - UserPresets = PresetType("user") - - // UIPresets is used to retrieve only ui (standard) presets in the - // response of ListPresets or GetPreset methods. - UIPresets = PresetType("ui") -) - -// PresetType represents the type of preset used as the input of the -// ListPresets and GetPreset methods. -type PresetType string - -// Preset represents a preset in the Encoding.com API. -type Preset struct { - Name string `json:"name"` - Type PresetType `json:"type"` - Output string `json:"output"` - Format PresetFormat `json:"format"` -} - -// PresetFormat is the set of options for defining the output format in -// presets. -type PresetFormat struct { - NoiseReduction string `json:"noise_reduction,omitempty"` - Output string `json:"output,omitempty"` - VideoCodec string `json:"video_codec,omitempty"` - AudioCodec string `json:"audio_codec,omitempty"` - Bitrate string `json:"bitrate,omitempty"` - AudioBitrate string `json:"audio_bitrate,omitempty"` - AudioSampleRate uint `json:"audio_sample_rate,string,omitempty"` - AudioChannelsNumber string `json:"audio_channels_number,omitempty"` - AudioVolume uint `json:"audio_volume,string,omitempty"` - Framerate string `json:"framerate,omitempty"` - FramerateUpperThreshold string `json:"framerate_upper_threshold,omitempty"` - Size string `json:"size,omitempty"` - FadeIn string `json:"fade_in,omitempty"` - FadeOut string `json:"fade_out,omitempty"` - CropLeft int `json:"crop_left,string,omitempty"` - CropTop int `json:"crop_top,string,omitempty"` - CropRight int `json:"crop_right,string,omitempty"` - CropBottom int `json:"crop_bottom,string,omitempty"` - SetAspectRatio string `json:"set_aspect_ratio,omitempty"` - RcInitOccupancy string `json:"rc_init_occupancy,omitempty"` - MinRate string `json:"minrate,omitempty"` - MaxRate string `json:"maxrate,omitempty"` - BufSize string `json:"bufsize,omitempty"` - Keyframe string `json:"keyframe,omitempty"` - Start string `json:"start,omitempty"` - Duration string `json:"duration,omitempty"` - ForceKeyframes string `json:"force_keyframes,omitempty"` - Bframes int `json:"bframes,string,omitempty"` - Gop string `json:"gop,omitempty"` - Metadata *Metadata `json:"metadata,omitempty"` - SegmentDuration string `json:"segment_duration,omitempty"` - Logo *Logo `json:"logo,omitempty"` - VideoCodecParameters interface{} `json:"video_codec_parameters,omitempty"` - Profile string `json:"profile,omitempty"` - Rotate string `json:"rotate,omitempty"` - SetRotate string `json:"set_rotate,omitempty"` - AudioSync string `json:"audio_sync,omitempty"` - VideoSync string `json:"video_sync,omitempty"` - ForceInterlaced string `json:"force_interlaced,omitempty"` - KeepAspectRatio YesNoBoolean `json:"keep_aspect_ratio,omitempty"` - AddMeta YesNoBoolean `json:"add_meta,omitempty"` - Hint YesNoBoolean `json:"hint,omitempty"` - TwoPass YesNoBoolean `json:"two_pass,omitempty"` - Turbo YesNoBoolean `json:"turbo,omitempty"` - TwinTurbo YesNoBoolean `json:"twin_turbo,omitempty"` - StripChapters YesNoBoolean `json:"strip_chapters,omitempty"` - StreamRawMap interface{} `json:"stream,omitempty"` -} - -// Stream function returns a slice of Advanced HLS stream settings for a -// preset format. -func (p PresetFormat) Stream() []Stream { - var ( - stream Stream - streams []Stream - ) - streamRaw, _ := json.Marshal(p.StreamRawMap) - if err := json.Unmarshal(streamRaw, &stream); err != nil { - json.Unmarshal(streamRaw, &streams) - } else { - streams = append(streams, stream) - } - return streams -} - -// SavePresetResponse is the response returned in the SavePreset method. -// -// See http://goo.gl/q0xPuh for more details. -type SavePresetResponse struct { - SavedPreset string -} - -// SavePreset uses the given name and the given format to create a new preset -// in the Encoding.com API. The remote API will generate and return the preset -// name if the name is not provided. -// -// See http://goo.gl/q0xPuh for more details. -func (c *Client) SavePreset(name string, format Format) (*SavePresetResponse, error) { - var result map[string]struct { - Message string `json:"message,omitempty"` - SavedPreset string `json:"SavedPreset,omitempty"` - } - err := c.do(&request{Action: "SavePreset", Name: name, Format: []Format{format}}, &result) - if err != nil { - return nil, err - } - return &SavePresetResponse{SavedPreset: result["response"].SavedPreset}, nil -} - -// GetPreset returns details about a given preset in the Encoding.com API. It -// queries both user and UI presets. -// -// See http://goo.gl/6Sdjeb for more details. -func (c *Client) GetPreset(name string) (*Preset, error) { - var result map[string]*Preset - err := c.do(&request{Action: "GetPreset", Type: "all", Name: name}, &result) - if err != nil { - return nil, err - } - return result["response"], nil -} - -// ListPresetsResponse represents the response returned by the GetPresetsList -// action. -// -// See http://goo.gl/sugm5F for more details. -type ListPresetsResponse struct { - UserPresets []Preset `json:"user"` - UIPresets []Preset `json:"ui"` -} - -// ListPresets (GetPresetsList action in the Encoding.com API) returns a list -// of the presets matching the given type. -// -// See http://goo.gl/sugm5F for more details. -func (c *Client) ListPresets(presetType PresetType) (*ListPresetsResponse, error) { - var result map[string]*ListPresetsResponse - err := c.do(&request{Action: "GetPresetsList", Type: string(presetType)}, &result) - if err != nil { - return nil, err - } - return result["response"], nil -} - -// DeletePreset delets the given preset from the Encoding.com API. -// -// See http://goo.gl/yrYTn5 for more details. -func (c *Client) DeletePreset(name string) (*Response, error) { - var result map[string]*Response - err := c.do(&request{Action: "DeletePreset", Name: name}, &result) - if err != nil { - return nil, err - } - return result["response"], nil -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/preset_test.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/preset_test.go deleted file mode 100644 index bfe62d88..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/preset_test.go +++ /dev/null @@ -1,484 +0,0 @@ -package encodingcom - -import ( - "encoding/json" - - "gopkg.in/check.v1" -) - -func (s *S) TestGetPresetsList(c *check.C) { - server, requests := s.startServer(` -{ - "response": { - "user": [{ - "name":"webm_1080p", - "type":"user", - "output":"webm", - "format":{ - "output":"webm", - "audio_bitrate":"192k", - "audio_sample_rate":"48000", - "bitrate":"5000k", - "framerate":"30", - "keep_aspect_ratio":"no", - "set_aspect_ratio":"1280 x 1080", - "video_codec":"libvpx", - "video_codec_parameters":"no", - "size":"1920x1080" - } - }, - { - "name":"webm_480p", - "type":"user", - "output":"webm", - "format":{ - "output":"webm", - "audio_bitrate":"192k", - "audio_sample_rate":"48000", - "bitrate":"2500k", - "framerate":"30", - "video_codec":"libvpx", - "video_codec_parameters":"no", - "size":"1280x480" - } - }, - { - "name":"sample_hls", - "type":"user", - "output":"advanced_hls", - "format":{ - "output":"advanced_hls", - "stream":{ - "audio_bitrate":"64k", - "audio_codec":"dolby_aac", - "audio_volume":"100", - "bitrate":"1000k", - "keyframe":"90", - "profile":"Main", - "size":"1080x720", - "two_pass":"yes", - "video_codec":"libx264", - "video_codec_parameters": { - "keyint_min": "25", - "sc_threshold": "40" - } - } - } - }], - "ui": [ - { - "name":"3GP 144p 256k", - "type":"ui", - "output":"3gp", - "format":{ - "output":"3gp", - "size":"176x144", - "bitrate":"256k", - "audio_bitrate":"12.2k", - "audio_sample_rate":"8000", - "audio_channels_number":"1", - "framerate":"15", - "keep_aspect_ratio":"yes", - "video_codec":"h263", - "profile":"baseline", - "audio_codec":"libamr_nb", - "two_pass":"no", - "turbo":"no", - "twin_turbo":"no", - "keyframe":"90", - "audio_volume":"100", - "rotate":"def", - "strip_chapters":"no" - } - }, - { - "name":"3GP 288p 360k", - "type":"ui", - "output":"3gp", - "format":{ - "output":"3gp", - "size":"352x288", - "bitrate":"360k", - "audio_bitrate":"12.2k", - "audio_sample_rate":"8000", - "audio_channels_number":"1", - "framerate":"24", - "keep_aspect_ratio":"yes", - "video_codec":"h263", - "profile":"baseline", - "audio_codec":"libamr_nb", - "two_pass":"no", - "turbo":"no", - "twin_turbo":"no", - "keyframe":"120", - "audio_volume":"100", - "rotate":"def", - "strip_chapters":"no" - } - }] - } -}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.ListPresets(AllPresets) - c.Assert(err, check.IsNil) - - c.Assert(resp, check.DeepEquals, &ListPresetsResponse{ - UserPresets: []Preset{ - { - Name: "webm_1080p", - Type: "user", - Output: "webm", - Format: PresetFormat{ - Output: "webm", - AudioBitrate: "192k", - AudioSampleRate: 48000, - Bitrate: "5000k", - Framerate: "30", - KeepAspectRatio: YesNoBoolean(false), - SetAspectRatio: "1280 x 1080", - VideoCodec: "libvpx", - VideoCodecParameters: "no", - Size: "1920x1080", - }, - }, - { - Name: "webm_480p", - Type: "user", - Output: "webm", - Format: PresetFormat{ - Output: "webm", - AudioBitrate: "192k", - AudioSampleRate: 48000, - Bitrate: "2500k", - Framerate: "30", - VideoCodec: "libvpx", - VideoCodecParameters: "no", - Size: "1280x480", - }, - }, - { - Name: "sample_hls", - Type: "user", - Output: "advanced_hls", - Format: PresetFormat{ - Output: "advanced_hls", - StreamRawMap: map[string]interface{}{ - "audio_bitrate": "64k", - "audio_volume": "100", - "size": "1080x720", - "two_pass": "yes", - "video_codec": "libx264", - "audio_codec": "dolby_aac", - "bitrate": "1000k", - "keyframe": "90", - "profile": "Main", - "video_codec_parameters": map[string]interface{}{ - "keyint_min": "25", - "sc_threshold": "40", - }, - }, - }, - }, - }, - UIPresets: []Preset{ - { - Name: "3GP 144p 256k", - Type: "ui", - Output: "3gp", - Format: PresetFormat{ - Output: "3gp", - Size: "176x144", - Bitrate: "256k", - AudioBitrate: "12.2k", - AudioSampleRate: 8000, - AudioChannelsNumber: "1", - Framerate: "15", - KeepAspectRatio: YesNoBoolean(true), - VideoCodec: "h263", - Profile: "baseline", - AudioCodec: "libamr_nb", - TwoPass: YesNoBoolean(false), - Turbo: YesNoBoolean(false), - TwinTurbo: YesNoBoolean(false), - Keyframe: "90", - AudioVolume: 100, - Rotate: "def", - StripChapters: YesNoBoolean(false), - }, - }, - { - Name: "3GP 288p 360k", - Type: "ui", - Output: "3gp", - Format: PresetFormat{ - Output: "3gp", - Size: "352x288", - Bitrate: "360k", - AudioBitrate: "12.2k", - AudioSampleRate: 8000, - AudioChannelsNumber: "1", - Framerate: "24", - KeepAspectRatio: YesNoBoolean(true), - VideoCodec: "h263", - Profile: "baseline", - AudioCodec: "libamr_nb", - TwoPass: YesNoBoolean(false), - Turbo: YesNoBoolean(false), - TwinTurbo: YesNoBoolean(false), - Keyframe: "120", - AudioVolume: 100, - Rotate: "def", - StripChapters: YesNoBoolean(false), - }, - }, - }, - }) - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetPresetsList") - c.Assert(req.query["type"], check.Equals, string(AllPresets)) - - sampleHlsStream := Stream{ - AudioBitrate: "64k", - AudioVolume: 100, - Size: "1080x720", - TwoPass: YesNoBoolean(true), - VideoCodec: "libx264", - AudioCodec: "dolby_aac", - Bitrate: "1000k", - Keyframe: "90", - Profile: "Main", - VideoCodecParametersRaw: map[string]interface{}{ - "sc_threshold": "40", - "keyint_min": "25", - }, - } - sampleVideoCodecParams := VideoCodecParameters{ - ScThreshold: "40", - KeyIntMin: "25", - } - for _, hlsPreset := range resp.UserPresets { - if hlsPreset.Output == "advanced_hls" { - streams := hlsPreset.Format.Stream() - c.Assert(streams[0], check.DeepEquals, sampleHlsStream) - c.Assert(streams[0].VideoCodecParameters(), check.DeepEquals, sampleVideoCodecParams) - } - } -} - -func (s *S) TestPresetFormatStream(c *check.C) { - var tests = []struct { - testCase string - streamRaw interface{} - expected []Stream - }{ - { - "single stream", - map[string]interface{}{ - "audio_bitrate": "64k", - "audio_volume": "100", - "size": "1080x720", - "two_pass": "yes", - }, - []Stream{ - { - AudioBitrate: "64k", - AudioVolume: 100, - Size: "1080x720", - TwoPass: YesNoBoolean(true), - }, - }, - }, - { - "multiple streams", - []map[string]interface{}{ - { - "audio_bitrate": "64k", - "audio_volume": "100", - "size": "1080x720", - "two_pass": "yes", - }, - { - "audio_bitrate": "128k", - "audio_volume": "100", - "size": "1920x1080", - "two_pass": "yes", - }, - }, - []Stream{ - { - AudioBitrate: "64k", - AudioVolume: 100, - Size: "1080x720", - TwoPass: YesNoBoolean(true), - }, - { - AudioBitrate: "128k", - AudioVolume: 100, - Size: "1920x1080", - TwoPass: YesNoBoolean(true), - }, - }, - }, - } - for _, test := range tests { - p := PresetFormat{StreamRawMap: test.streamRaw} - streams := p.Stream() - c.Check(streams, check.DeepEquals, test.expected) - } -} - -func (s *S) TestGetPreset(c *check.C) { - server, requests := s.startServer(` -{ - "response": { - "name":"webm_1080p", - "type":"user", - "output":"webm", - "format":{ - "output":"webm", - "audio_bitrate":"192k", - "audio_sample_rate":"48000", - "bitrate":"5000k", - "framerate":"30", - "keep_aspect_ratio":"no", - "set_aspect_ratio":"1280 x 1080", - "video_codec":"libvpx", - "video_codec_parameters":"no", - "size":"1920x1080" - } - } -}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - preset, err := client.GetPreset("webm_1080p") - c.Assert(err, check.IsNil) - expected := Preset{ - Name: "webm_1080p", - Type: "user", - Output: "webm", - Format: PresetFormat{ - Output: "webm", - AudioBitrate: "192k", - AudioSampleRate: 48000, - Bitrate: "5000k", - Framerate: "30", - KeepAspectRatio: YesNoBoolean(false), - SetAspectRatio: "1280 x 1080", - VideoCodec: "libvpx", - VideoCodecParameters: "no", - Size: "1920x1080", - }, - } - c.Assert(*preset, check.DeepEquals, expected) - - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetPreset") - c.Assert(req.query["type"], check.Equals, string(AllPresets)) - c.Assert(req.query["name"], check.Equals, "webm_1080p") -} - -func (s *S) TestGetPresetError(c *check.C) { - server, requests := s.startServer(`{"response": {"errors": {"error": "can't get no presetisfaction"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.GetPreset("my-preciouset") - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetPreset") -} - -func (s *S) TestSavePreset(c *check.C) { - server, requests := s.startServer(` - { - "response": { - "message": "Saved", - "SavedPreset": "mp4_1080p" - } - } -`) - defer server.Close() - - format := Format{ - VideoCodec: "x264", - AudioCodec: "aac", - Bitrate: "900k", - AudioBitrate: "64k", - Size: "1920x1080", - } - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.SavePreset("mp4_1080p", format) - c.Assert(err, check.IsNil) - c.Assert(resp.SavedPreset, check.Equals, "mp4_1080p") - - rawFormat, err := json.Marshal([]Format{format}) - c.Assert(err, check.IsNil) - var expectedFormat []interface{} - err = json.Unmarshal(rawFormat, &expectedFormat) - c.Assert(err, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "SavePreset") - c.Assert(req.query["name"], check.Equals, "mp4_1080p") - c.Assert(req.query["format"], check.DeepEquals, expectedFormat) -} - -func (s *S) TestSavePresetError(c *check.C) { - server, requests := s.startServer(`{"response": {"errors": {"error": "incomplete preset data"}}}`) - defer server.Close() - - format := Format{VideoCodec: "x264"} - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.SavePreset("preset-1", format) - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "SavePreset") -} - -func (s *S) TestDeletePreset(c *check.C) { - server, requests := s.startServer(` - { - "response":{ - "message":"Deleted" - } - } -`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.DeletePreset("mp4_1080p") - c.Assert(err, check.IsNil) - c.Assert(resp.Message, check.Equals, "Deleted") - - req := <-requests - c.Assert(req.query["action"], check.Equals, "DeletePreset") - c.Assert(req.query["name"], check.Equals, "mp4_1080p") -} - -func (s *S) TestDeletePresetError(c *check.C) { - server, requests := s.startServer(`{"response": {"errors": {"error": "no preset, try postset"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.DeletePreset("some-preset") - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "DeletePreset") -} - -func (s *S) TestListPresetsError(c *check.C) { - server, requests := s.startServer(`{"response": {"errors": {"error": "who moved my preset?"}}}`) - defer server.Close() - - client := Client{Endpoint: server.URL, UserID: "myuser", UserKey: "123"} - resp, err := client.ListPresets(AllPresets) - c.Assert(err, check.NotNil) - c.Assert(resp, check.IsNil) - req := <-requests - c.Assert(req.query["action"], check.Equals, "GetPresetsList") -} diff --git a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/suite_test.go b/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/suite_test.go deleted file mode 100644 index 10b77a06..00000000 --- a/vendor/github.com/NYTimes/encoding-wrapper/encodingcom/suite_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package encodingcom - -import ( - "encoding/json" - "net/http" - "net/http/httptest" - "testing" - - "gopkg.in/check.v1" -) - -type S struct{} - -func Test(t *testing.T) { - check.TestingT(t) -} - -var _ = check.Suite(&S{}) - -type fakeServerRequest struct { - req *http.Request - query map[string]interface{} -} - -func (s *S) startServer(content string) (*httptest.Server, chan fakeServerRequest) { - requests := make(chan fakeServerRequest, 1) - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - data := r.FormValue("json") - var m map[string]interface{} - json.Unmarshal([]byte(data), &m) - fakeRequest := fakeServerRequest{req: r, query: m["query"].(map[string]interface{})} - requests <- fakeRequest - w.Write([]byte(content)) - })) - return server, requests -} diff --git a/vendor/github.com/NYTimes/gizmo/.gitignore b/vendor/github.com/NYTimes/gizmo/.gitignore deleted file mode 100644 index 12afa21a..00000000 --- a/vendor/github.com/NYTimes/gizmo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.swp -.cover diff --git a/vendor/github.com/NYTimes/gizmo/.travis.yml b/vendor/github.com/NYTimes/gizmo/.travis.yml deleted file mode 100644 index 0ca58542..00000000 --- a/vendor/github.com/NYTimes/gizmo/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: go - -before_install: - # Decrypts a script that installs an authenticated cookie - # for git to use when cloning from googlesource.com. - # Bypasses "bandwidth limit exceeded" errors. - # See github.com/golang/go/issues/12933 - - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then openssl aes-256-cbc -K $encrypted_83935ad6c1b7_key -iv $encrypted_83935ad6c1b7_iv -in gitcookies.sh.enc -out gitcookies.sh -d; fi - - go get github.com/axw/gocov/gocov - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover - -install: - - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash gitcookies.sh; fi - -script: - - make test - - make coverage - -go: - - 1.8.x diff --git a/vendor/github.com/NYTimes/gizmo/CODE_OF_CONDUCT.md b/vendor/github.com/NYTimes/gizmo/CODE_OF_CONDUCT.md deleted file mode 100644 index a0a50ac9..00000000 --- a/vendor/github.com/NYTimes/gizmo/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -layout: code-of-conduct -version: v1.0 ---- - -This code of conduct outlines our expectations for participants within the **Gizmo** community, as well as steps to reporting unacceptable behavior. We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored. Anyone who violates this code of conduct may be banned from the community. - -Our open source community strives to: - -* **Be friendly and patient.** -* **Be welcoming**: We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability. -* **Be considerate**: Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language. -* **Be respectful**: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. -* **Be careful in the words that we choose**: we are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. -* **Try to understand why we disagree**: Disagreements, both social and technical, happen all the time. It is important that we resolve disagreements and differing views constructively. Remember that we’re different. The strength of our community comes from its diversity, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes. - -## Definitions - -Harassment includes, but is not limited to: - -- Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, neuro(a)typicality, physical appearance, body size, race, age, regional discrimination, political or religious affiliation -- Unwelcome comments regarding a person’s lifestyle choices and practices, including those related to food, health, parenting, drugs, and employment -- Deliberate misgendering. This includes deadnaming or persistently using a pronoun that does not correctly reflect a person's gender identity. You must address people by the name they give you when not addressing them by their username or handle -- Physical contact and simulated physical contact (eg, textual descriptions like “*hug*” or “*backrub*”) without consent or after a request to stop -- Threats of violence, both physical and psychological -- Incitement of violence towards any individual, including encouraging a person to commit suicide or to engage in self-harm -- Deliberate intimidation -- Stalking or following -- Harassing photography or recording, including logging online activity for harassment purposes -- Sustained disruption of discussion -- Unwelcome sexual attention, including gratuitous or off-topic sexual images or behaviour -- Pattern of inappropriate social contact, such as requesting/assuming inappropriate levels of intimacy with others -- Continued one-on-one communication after requests to cease -- Deliberate “outing” of any aspect of a person’s identity without their consent except as necessary to protect others from intentional abuse -- Publication of non-harassing private communication - -Our open source community prioritizes marginalized people’s safety over privileged people’s comfort. We will not act on complaints regarding: - -- ‘Reverse’ -isms, including ‘reverse racism,’ ‘reverse sexism,’ and ‘cisphobia’ -- Reasonable communication of boundaries, such as “leave me alone,” “go away,” or “I’m not discussing this with you” -- Refusal to explain or debate social justice concepts -- Communicating in a ‘tone’ you don’t find congenial -- Criticizing racist, sexist, cissexist, or otherwise oppressive behavior or assumptions - - -### Diversity Statement - -We encourage everyone to participate and are committed to building a community for all. Although we will fail at times, we seek to treat everyone both as fairly and equally as possible. Whenever a participant has made a mistake, we expect them to take responsibility for it. If someone has been harmed or offended, it is our responsibility to listen carefully and respectfully, and do our best to right the wrong. - -Although this list cannot be exhaustive, we explicitly honor diversity in age, gender, gender identity or expression, culture, ethnicity, language, national origin, political beliefs, profession, race, religion, sexual orientation, socioeconomic status, and technical ability. We will not tolerate discrimination based on any of the protected -characteristics above, including participants with disabilities. - -### Reporting Issues - -If you experience or witness unacceptable behavior—or have any other concerns—please report it by contacting us via **code@nytimes.com**. All reports will be handled with discretion. In your report please include: - -- Your contact information. -- Names (real, nicknames, or pseudonyms) of any individuals involved. If there are additional witnesses, please -include them as well. Your account of what occurred, and if you believe the incident is ongoing. If there is a publicly available record (e.g. a mailing list archive or a public IRC logger), please include a link. -- Any additional information that may be helpful. - -After filing a report, a representative will contact you personally, review the incident, follow up with any additional questions, and make a decision as to how to respond. If the person who is harassing you is part of the response team, they will recuse themselves from handling your incident. If the complaint originates from a member of the response team, it will be handled by a different member of the response team. We will respect confidentiality requests for the purpose of protecting victims of abuse. - -### Attribution & Acknowledgements - -We all stand on the shoulders of giants across many open source communities. We'd like to thank the communities and projects that established code of conducts and diversity statements as our inspiration: - -* [Django](https://www.djangoproject.com/conduct/reporting/) -* [Python](https://www.python.org/community/diversity/) -* [Ubuntu](http://www.ubuntu.com/about/about-ubuntu/conduct) -* [Contributor Covenant](http://contributor-covenant.org/) -* [Geek Feminism](http://geekfeminism.org/about/code-of-conduct/) -* [Citizen Code of Conduct](http://citizencodeofconduct.org/) - -This Code of Conduct was based on https://github.com/todogroup/opencodeofconduct diff --git a/vendor/github.com/NYTimes/gizmo/CONTRIBUTING.md b/vendor/github.com/NYTimes/gizmo/CONTRIBUTING.md deleted file mode 100644 index ecc160b7..00000000 --- a/vendor/github.com/NYTimes/gizmo/CONTRIBUTING.md +++ /dev/null @@ -1,35 +0,0 @@ -# Contributing to Gizmo - -Gizmo is an open source project started by handful of developers at The New York Times and open to the entire Go community. - -We really appreciate your help! - -## Filing issues - -When filing an issue, make sure to answer these five questions: - -1. What version of Go are you using (`go version`)? -2. What operating system and processor architecture are you using? -3. What did you do? -4. What did you expect to see? -5. What did you see instead? - -General questions should go to the [#gizmo](https://gophers.slack.com/messages/gizmo/) channel in the [Gopher Slack community](https://blog.gopheracademy.com/gophers-slack-community/) instead of the issue tracker. The gophers there will answer or ask you to file an issue if you've tripped over a bug. - -## Contributing code - -Before submitting changes, please follow these guidelines: - -1. Check the open issues and pull requests for existing discussions. -2. Open an issue to discuss a new feature. -3. Write tests. -4. Make sure code follows the ['Go Code Review Comments'](https://github.com/golang/go/wiki/CodeReviewComments). -5. Make sure your changes pass `make test`. -6. Make sure the entire test suite passes locally and on Travis CI. -7. Open a Pull Request. -8. [Squash your commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) after receiving feedback and add a [great commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). - -Unless otherwise noted, the Gizmo source files are distributed under -the Apache 2.0-style license found in the LICENSE.md file. - -[Please review our Code of Conduct](https://github.com/NYTimes/gizmo/blob/master/CODE_OF_CONDUCT.md) diff --git a/vendor/github.com/NYTimes/gizmo/LICENSE b/vendor/github.com/NYTimes/gizmo/LICENSE deleted file mode 100644 index df6192d3..00000000 --- a/vendor/github.com/NYTimes/gizmo/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016-2017 The New York Times Company - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/NYTimes/gizmo/Makefile b/vendor/github.com/NYTimes/gizmo/Makefile deleted file mode 100644 index 22005823..00000000 --- a/vendor/github.com/NYTimes/gizmo/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -all: test - -deps: - go get -d -v github.com/NYTimes/gizmo/... - -updatedeps: - go get -d -v -u -f github.com/NYTimes/gizmo/... - -testdeps: - go get -d -v -t github.com/NYTimes/gizmo/... - -updatetestdeps: - go get -d -v -t -u -f github.com/NYTimes/gizmo/... - -build: deps - go build github.com/NYTimes/gizmo/... - -install: deps - go install github.com/NYTimes/gizmo/... - -lint: testdeps - go get -v github.com/golang/lint/golint - for file in $$(find . -name '*.go' | grep -v '\.pb\.go\|\.pb\.gw\.go\|examples\|pubsub\/aws\/awssub_test\.go' | grep -v 'server\/kit\/kitserver_pb_test\.go'); do \ - golint $${file}; \ - if [ -n "$$(golint $${file})" ]; then \ - exit 1; \ - fi; \ - done - -vet: testdeps - go vet github.com/NYTimes/gizmo/... - -errcheck: testdeps - go get -v github.com/kisielk/errcheck - errcheck -ignoretests github.com/NYTimes/gizmo/... - -pretest: lint vet # errcheck - -test: testdeps pretest - go test github.com/NYTimes/gizmo/... - -clean: - go clean -i github.com/NYTimes/gizmo/... - -coverage: testdeps - ./coverage.sh --coveralls - -.PHONY: \ - all \ - deps \ - updatedeps \ - testdeps \ - updatetestdeps \ - build \ - install \ - lint \ - vet \ - errcheck \ - pretest \ - test \ - clean \ - coverage diff --git a/vendor/github.com/NYTimes/gizmo/README.md b/vendor/github.com/NYTimes/gizmo/README.md deleted file mode 100644 index 337ef7f6..00000000 --- a/vendor/github.com/NYTimes/gizmo/README.md +++ /dev/null @@ -1,252 +0,0 @@ -# Gizmo Microservice Toolkit [![GoDoc](https://godoc.org/github.com/gizmo/gizmo?status.svg)](https://godoc.org/github.com/NYTimes/gizmo) [![Build Status](https://travis-ci.org/NYTimes/gizmo.svg?branch=master)](https://travis-ci.org/NYTimes/gizmo) [![Coverage Status](https://coveralls.io/repos/NYTimes/gizmo/badge.svg?branch=master&service=github)](https://coveralls.io/github/NYTimes/gizmo?branch=master) - -![Gizmo!](http://graphics8.nytimes.com/images/blogs/open/2015/gizmo.png) - -This toolkit provides packages to put together server and pubsub daemons with the following features: - -* standardized configuration and logging -* health check endpoints with configurable strategies -* configuration for managing pprof endpoints and log levels -* structured logging containing basic request information -* useful metrics for endpoints -* graceful shutdowns -* basic interfaces to define our expectations and vocabulary - -In this toolkit, you will find: - -## The `config` packages - -The `config` package contains a handful of useful functions to load to configuration structs from JSON files, JSON blobs in Consul k/v or environment variables. - -The subpackages contain structs meant for managing common configuration options and credentials. There are currently configs for: - -* Go Kit Metrics -* MySQL -* MongoDB -* Oracle -* PostgreSQL -* AWS (S3, DynamoDB, ElastiCache) -* GCP -* Gorilla's `securecookie` - -The package also has a generic `Config` type in the `config/combined` subpackage that contains all of the above types. It's meant to be a 'catch all' convenience struct that many applications should be able to use. - -## The `server` package - -This package is the bulk of the toolkit and relies on `server.Config` for any managing `Server` implementations. A server must implement the following interface: - -```go -// Server is the basic interface that defines what expect from any server. -type Server interface { - Register(Service) error - Start() error - Stop() error -} -``` - -The package offers 2 server implementations: - -`SimpleServer`, which is capable of handling basic HTTP and JSON requests via 5 of the available `Service` implementations: `SimpleService`, `JSONService`, `ContextService`, `MixedService` and a `MixedContextService`. A service and these implementations will be defined below. - -`RPCServer`, which is capable of serving a gRPC server on one port and JSON endpoints on another. This kind of server can only handle the `RPCService` implementation. - -The `Service` interface is minimal to allow for maximum flexibility: -```go -type Service interface { - Prefix() string - - // Middleware provides a hook for service-wide middleware. - Middleware(http.Handler) http.Handler -} -``` - -The 5 service types that are accepted and hostable on the `SimpleServer`: - -```go -type SimpleService interface { - Service - - // router - method - func - Endpoints() map[string]map[string]http.HandlerFunc -} - -type JSONService interface { - Service - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONEndpoints. - JSONMiddleware(JSONEndpoint) JSONEndpoint -} - -type MixedService interface { - Service - - // route - method - func - Endpoints() map[string]map[string]http.HandlerFunc - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONEndpoints. - JSONMiddleware(JSONEndpoint) JSONEndpoint -} - -type ContextService interface { - Service - - // route - method - func - ContextEndpoints() map[string]map[string]ContextHandlerFunc - // ContextMiddleware provides a hook for service-wide middleware around ContextHandler - ContextMiddleware(ContextHandler) ContextHandler -} - -type MixedContextService interface { - ContextService - - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - JSONContextMiddleware(JSONContextEndpoint) JSONContextEndpoint -} -``` - -Where `JSONEndpoint`, `JSONContextEndpoint`, `ContextHandler` and `ContextHandlerFunc` are defined as: - -```go -type JSONEndpoint func(*http.Request) (int, interface{}, error) - -type JSONContextEndpoint func(context.Context, *http.Request) (int, interface{}, error) - -type ContextHandler interface { - ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) -} - -type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request) -``` - -Also, the one service type that works with an `RPCServer`: - -```go -type RPCService interface { - ContextService - - Service() (grpc.ServiceDesc, interface{}) - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONContextEndpoints. - JSONMiddlware(JSONContextEndpoint) JSONContextEndpoint -} -``` - -The `Middleware(..)` functions offer each service a 'hook' to wrap each of its endpoints. This may be handy for adding additional headers or context to the request. This is also the point where other, third-party middleware could be easily plugged in (i.e. oauth, tracing, metrics, logging, etc.) - -## The `pubsub` packages - -The base `pubsub` package contains three generic interfaces for publishing data to queues and subscribing and consuming data from those queues. - -```go -// Publisher is a generic interface to encapsulate how we want our publishers -// to behave. Until we find reason to change, we're forcing all publishers -// to emit protobufs. -type Publisher interface { - // Publish will publish a message. - Publish(ctx context.Context, key string, msg proto.Message) error - // Publish will publish a []byte message. - PublishRaw(ctx context.Context, key string, msg []byte) error -} - -// MultiPublisher is an interface for publishers who support sending multiple -// messages in a single request, in addition to individual messages. -type MultiPublisher interface { - Publisher - - // PublishMulti will publish multiple messages with a context. - PublishMulti(context.Context, []string, []proto.Message) error - // PublishMultiRaw will publish multiple raw byte array messages with a context. - PublishMultiRaw(context.Context, []string, [][]byte) error -} - -// Subscriber is a generic interface to encapsulate how we want our subscribers -// to behave. For now the system will auto stop if it encounters any errors. If -// a user encounters a closed channel, they should check the Err() method to see -// what happened. -type Subscriber interface { - // Start will return a channel of raw messages. - Start() <-chan SubscriberMessage - // Err will contain any errors returned from the consumer connection. - Err() error - // Stop will initiate a graceful shutdown of the subscriber connection. - Stop() error -} -``` - -Where a `SubscriberMessage` is an interface that gives implementations a hook for acknowledging/delete messages. Take a look at the docs for each implementation in `pubsub` to see how they behave. - -There are currently major 4 implementations of the `pubsub` interfaces: - -For pubsub via Amazon's SNS/SQS, you can use the `pubsub/aws` package. - -For pubsub via Google's Pubsub, you can use the `pubsub/gcp` package. This package offers 2 ways of publishing to Google PubSub. `gcp.NewPublisher` uses the RPC client and `gcp.NewHTTPPublisher` will publish over plain HTTP, which is useful for the App Engine standard environment. - -For pubsub via Kafka topics, you can use the `pubsub/kafka` package. - -For publishing via HTTP, you can use the `pubsub/http` package. - -The `MultiPublisher` interface is only implemented by `pubsub/gcp`. - -## The `pubsub/pubsubtest` package - -This package contains 'test' implementations of the `pubsub.Publisher`, `pubsub.MultiPublisher`, and `pubsub.Subscriber` interfaces that will allow developers to easily mock out and test their `pubsub` implementations: - -```go -type TestPublisher struct { - // Published will contain a list of all messages that have been published. - Published []TestPublishMsg - - // GivenError will be returned by the TestPublisher on publish. - // Good for testing error scenarios. - GivenError error - - // FoundError will contain any errors encountered while marshalling - // the protobuf struct. - FoundError error -} - -type TestSubscriber struct { - // ProtoMessages will be marshalled into []byte used to mock out - // a feed if it is populated. - ProtoMessages []proto.Message - - // JSONMEssages will be marshalled into []byte and used to mock out - // a feed if it is populated. - JSONMessages []interface{} - - // GivenErrError will be returned by the TestSubscriber on Err(). - // Good for testing error scenarios. - GivenErrError error - - // GivenStopError will be returned by the TestSubscriber on Stop(). - // Good for testing error scenarios. - GivenStopError error - - // FoundError will contain any errors encountered while marshalling - // the JSON and protobuf struct. - FoundError error -} -``` - -## The `web` package - -This package contains a handful of very useful functions for parsing types from request queries and payloads. - -## Examples - -* Several reference implementations utilizing `server` and `pubsub` are available in the ['examples'](https://github.com/NYTimes/gizmo/tree/master/examples) subdirectory. - -The Gizmo logo was based on the Go mascot designed by Renée French and copyrighted under the Creative Commons Attribution 3.0 license. diff --git a/vendor/github.com/NYTimes/gizmo/config/config.go b/vendor/github.com/NYTimes/gizmo/config/config.go deleted file mode 100644 index e5a506d9..00000000 --- a/vendor/github.com/NYTimes/gizmo/config/config.go +++ /dev/null @@ -1,71 +0,0 @@ -package config - -import ( - "encoding/json" - "io/ioutil" - "log" - "strings" - - "github.com/hashicorp/consul/api" - "github.com/kelseyhightower/envconfig" -) - -// EnvAppName is used as a prefix for environment variable -// names when using the LoadXFromEnv funcs. -// It defaults to empty. -var EnvAppName = "" - -// LoadEnvConfig will use envconfig to load the -// given config struct from the environment. -func LoadEnvConfig(c interface{}) { - err := envconfig.Process(EnvAppName, c) - if err != nil { - log.Fatalf("unable to load env variable for %T: %s", c, err) - } -} - -// LoadJSONFile is a helper function to read a config file into whatever -// config struct you need. For example, your custom config could be composed -// of one or more of the given Config, AWS, MySQL, Oracle or MongoDB structs. -func LoadJSONFile(fileName string, cfg interface{}) { - cb, err := ioutil.ReadFile(fileName) - if err != nil { - log.Fatalf("Unable to read config file '%s': %s", fileName, err) - } - - if err = json.Unmarshal(cb, &cfg); err != nil { - log.Fatalf("Unable to parse JSON in config file '%s': %s", fileName, err) - } -} - -// LoadJSONFromConsulKV is a helper function to read a JSON string found -// in a path defined by configKey inside Consul's Key Value storage then -// unmarshalled into a config struct, like LoadJSONFile does. -// It assumes that the Consul agent is running with the default setup, -// where the HTTP API is found via 127.0.0.1:8500. -func LoadJSONFromConsulKV(configKeyParameter string, cfg interface{}) interface{} { - configKeyParameterValue := strings.SplitN(configKeyParameter, ":", 2) - if len(configKeyParameterValue) < 2 { - log.Fatalf("Undefined Consul KV configuration path. It should be defined using the format consul:path/to/JSON/string") - } - configKey := configKeyParameterValue[1] - client, err := api.NewClient(api.DefaultConfig()) - if err != nil { - log.Fatalf("Unable to setup Consul client: %s", err) - } - kv := client.KV() - kvPair, _, err := kv.Get(configKey, nil) - if err != nil { - log.Fatalf("Unable to read config in key '%s' from Consul KV: %s", configKey, err) - } - if kvPair == nil { - log.Fatalf("Undefined key '%s' in Consul KV", configKey) - } - if len(kvPair.Value) == 0 { - log.Fatalf("Empty JSON in Consul KV for key '%s'", configKey) - } - if err = json.Unmarshal(kvPair.Value, &cfg); err != nil { - log.Fatalf("Unable to parse JSON in Consul KV for key '%s': %s", configKey, err) - } - return cfg -} diff --git a/vendor/github.com/NYTimes/gizmo/config/doc.go b/vendor/github.com/NYTimes/gizmo/config/doc.go deleted file mode 100644 index 3b1815bb..00000000 --- a/vendor/github.com/NYTimes/gizmo/config/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -/* -Package config contains a handful of useful functions to load to configuration structs from JSON files, JSON blobs in Consul k/v or environment variables. - -The subpackages contain structs meant for managing common configuration options and credentials. There are currently configs for: - -* Go Kit Metrics -* MySQL -* MongoDB -* Oracle -* PostgreSQL -* AWS (S3, DynamoDB, ElastiCache) -* GCP -* Gorilla's `securecookie` - -The package also has a generic `Config` type in the `config/combined` package that contains all of the above types. It's meant to be a 'catch all' convenience struct that many applications should be able to use. -*/ -package config diff --git a/vendor/github.com/NYTimes/gizmo/config/flags.go b/vendor/github.com/NYTimes/gizmo/config/flags.go deleted file mode 100644 index a5b563c7..00000000 --- a/vendor/github.com/NYTimes/gizmo/config/flags.go +++ /dev/null @@ -1,41 +0,0 @@ -package config - -import "flag" - -// DefaultConfigLocation is the default filepath for JSON config files. -const DefaultConfigLocation = "/opt/nyt/etc/conf.json" - -// SetLogOverride will check `*LogCLI` for any values -// and override the given string pointer if LogCLI is set. -// If LogCLI is set to "dev", the given log var will be set to "". -func SetLogOverride(log *string) { - // LogCLI is a pointer to the value of the '-log' command line flag. It is meant to declare - // an application logging location. - logCLI := flag.String("log", "", "Application log location") - - flag.Parse() - - // if a user passes in 'dev' log flag, override the - // App log to signal for stderr logging. - if *logCLI != "" { - *log = *logCLI - if *logCLI == "dev" { - *log = "" - } - } -} - -// SetFlagOverrides will add and check a `log` and `config` CLI flag to the -// current process, call flag.Parse() and will overwrite the passed in string -// pointer if the flag exists. -func SetFlagOverrides(log *string, config *string) { - // create the flag - cfg := flag.String("config", "", "Application log location") - SetLogOverride(log) - - // if a user passes in 'dev' log flag, override the - // App log to signal for stderr logging. - if *cfg != "" { - *config = *cfg - } -} diff --git a/vendor/github.com/NYTimes/gizmo/config/metrics/metrics.go b/vendor/github.com/NYTimes/gizmo/config/metrics/metrics.go deleted file mode 100644 index ecd14a79..00000000 --- a/vendor/github.com/NYTimes/gizmo/config/metrics/metrics.go +++ /dev/null @@ -1,111 +0,0 @@ -package metrics - -import ( - "time" - - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/metrics/dogstatsd" - "github.com/go-kit/kit/metrics/graphite" - "github.com/go-kit/kit/metrics/provider" - "github.com/go-kit/kit/metrics/statsd" - - "github.com/NYTimes/gizmo/config" -) - -// Type acts as an 'enum' type to represent -// the available metrics providers -type Type string - -const ( - // Statsd is used by config to indicate use of the statsdProvider. - Statsd Type = "statsd" - // DogStatsd is used by config to indicate use of the dogstatsdProvider. - DogStatsd Type = "dogstatsd" - // Prometheus is used by config to indicate use of the prometheusProvider. - Prometheus Type = "prometheus" - // Graphite is used by config to indicate use of the graphiteProvider. - Graphite Type = "graphite" - // Expvar is used by config to indicate use of the expvarProvider. - Expvar Type = "expvar" - // Discard is used by config to indicate use of the discardProvider. - Discard Type = "discard" -) - -// Config can be used to configure and instantiate a new -// go-kit/kit/metrics/provider.Provider. -type Config struct { - // if empty, will server default to "expvar" - Type Type `envconfig:"METRICS_TYPE"` - - // Prefix will be prefixed onto - // any metric name. - Prefix string `envconfig:"METRICS_PREFIX"` - - // Namespace is used by prometheus. - Namespace string `envconfig:"METRICS_NAMESPACE"` - // Subsystem is used by prometheus. - Subsystem string `envconfig:"METRICS_SUBSYSTEM"` - - // Used by statsd, graphite and dogstatsd - Interval time.Duration `envconfig:"METRICS_INTERVAL"` - - // Used by statsd, graphite and dogstatsd. - Addr string `envconfig:"METRICS_ADDR"` - // Used by statsd, graphite and dogstatsd to dial a connection. - // If empty, will default to "udp". - Network string `envconfig:"METRICS_NETWORK"` - - // Used by expvar only. - // if empty, will default to "/debug/vars" - Path string `envconfig:"METRICS_PATH"` - - // Used by graphite only. - // If none provided, kit/log/NewNopLogger will be used. - Logger log.Logger -} - -// LoadConfigFromEnv will attempt to load a Metrics object -// from environment variables. -func LoadConfigFromEnv() Config { - var mets Config - config.LoadEnvConfig(&mets) - return mets -} - -// NewProvider will use the values in the Metrics config object -// to generate a new go-kit/metrics/provider.Provider implementation. -// If no type is given, a no-op implementation will be used. -func (cfg Config) NewProvider() provider.Provider { - if cfg.Logger == nil { - cfg.Logger = log.NewNopLogger() - } - if cfg.Path == "" { - cfg.Path = "/debug/vars" - } - if cfg.Interval == 0 { - cfg.Interval = time.Second * 30 - } - switch cfg.Type { - case Statsd: - stsd := statsd.New(cfg.Prefix, cfg.Logger) - tick := time.NewTicker(cfg.Interval) - go stsd.SendLoop(tick.C, cfg.Network, cfg.Addr) - return provider.NewStatsdProvider(stsd, tick.Stop) - case DogStatsd: - stsd := dogstatsd.New(cfg.Prefix, cfg.Logger) - tick := time.NewTicker(cfg.Interval) - go stsd.SendLoop(tick.C, cfg.Network, cfg.Addr) - return provider.NewDogstatsdProvider(stsd, tick.Stop) - case Graphite: - grpht := graphite.New(cfg.Prefix, cfg.Logger) - tick := time.NewTicker(cfg.Interval) - go grpht.SendLoop(tick.C, cfg.Network, cfg.Addr) - return provider.NewGraphiteProvider(grpht, tick.Stop) - case Prometheus: - return provider.NewPrometheusProvider(cfg.Namespace, cfg.Subsystem) - case Expvar: - return provider.NewExpvarProvider() - default: - return provider.NewDiscardProvider() - } -} diff --git a/vendor/github.com/NYTimes/gizmo/coverage.sh b/vendor/github.com/NYTimes/gizmo/coverage.sh deleted file mode 100755 index 077a6d08..00000000 --- a/vendor/github.com/NYTimes/gizmo/coverage.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -set -e - -workdir=.cover -profile="$workdir/cover.out" -mode=set - -generate_cover_data() { - rm -rf "$workdir" - mkdir "$workdir" - - for pkg in "$@"; do - if [ $pkg == "github.com/NYTimes/gizmo/server" -o $pkg == "github.com/NYTimes/gizmo/server/kit" -o $pkg == "github.com/NYTimes/gizmo/config" -o $pkg == "github.com/NYTimes/gizmo/web" -o $pkg == "github.com/NYTimes/gizmo/pubsub" ] - then - f="$workdir/$(echo $pkg | tr / -)" - go test -covermode="$mode" -coverprofile="$f.cover" "$pkg" - fi - done - - echo "mode: $mode" >"$profile" - grep -h -v "^mode:" "$workdir"/*.cover >>"$profile" -} - -show_cover_report() { - go tool cover -${1}="$profile" -} - -push_to_coveralls() { - goveralls -coverprofile="$profile" -} - -generate_cover_data $(go list ./...) -show_cover_report func -case "$1" in -"") - ;; ---html) - show_cover_report html ;; ---coveralls) - push_to_coveralls ;; -*) - echo >&2 "error: invalid option: $1" ;; -esac -rm -rf "$workdir" diff --git a/vendor/github.com/NYTimes/gizmo/doc.go b/vendor/github.com/NYTimes/gizmo/doc.go deleted file mode 100644 index 2a3a7fe5..00000000 --- a/vendor/github.com/NYTimes/gizmo/doc.go +++ /dev/null @@ -1,221 +0,0 @@ -/* -Package gizmo is a toolkit that provides packages to put together server and pubsub daemons with the following features: - - * standardized configuration and logging - * health check endpoints with configurable strategies - * configuration for managing pprof endpoints and log levels - * structured logging containing basic request information - * useful metrics for endpoints - * graceful shutdowns - * basic interfaces to define our expectations and vocabulary - -## The `config` packages - -The `config` package contains a handful of useful functions to load to configuration structs from JSON files, JSON blobs in Consul k/v or environment variables. - -The subpackages contain structs meant for managing common configuration options and credentials. There are currently configs for: - - * Go Kit Metrics - * MySQL - * MongoDB - * Oracle - * AWS (S3, DynamoDB, ElastiCache) - * GCP - * Gorilla's `securecookie` - -The package also has a generic `Config` type in the `config/combined` subpackage that contains all of the above types. It's meant to be a 'catch all' convenience struct that many applications should be able to use. -The `server` package - -This package is the bulk of the toolkit and relies on `server.Config` for any managing `Server` implementations. A server must implement the following interface: - - // Server is the basic interface that defines what expect from any server. - type Server interface { - Register(Service) error - Start() error - Stop() error - } - -The package offers 2 server implementations: - -`SimpleServer`, which is capable of handling basic HTTP and JSON requests via 3 of the available `Service` implementations: `SimpleService`, `JSONService`, `ContextService`, `MixedService` and `MixedContextService`. A service and these implenetations will be defined below. - -`RPCServer`, which is capable of serving a gRPC server on one port and JSON endpoints on another. This kind of server can only handle the `RPCService` implementation. - -The `Service` interface is minimal to allow for maximum flexibility: - - type Service interface { - Prefix() string - - // Middleware provides a hook for service-wide middleware - Middleware(http.Handler) http.Handler - } - -The 3 service types that are accepted and hostable on the `SimpleServer`: - - type SimpleService interface { - Service - - // router - method - func - Endpoints() map[string]map[string]http.HandlerFunc - } - - type JSONService interface { - Service - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONEndpoints. - JSONMiddleware(JSONEndpoint) JSONEndpoint - } - - type MixedService interface { - Service - - // route - method - func - Endpoints() map[string]map[string]http.HandlerFunc - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONEndpoints. - JSONMiddleware(JSONEndpoint) JSONEndpoint - } - - type ContextService interface { - Service - - // route - method - func - ContextEndpoints() map[string]map[string]ContextHandlerFunc - // ContextMiddleware provides a hook for service-wide middleware around ContextHandler - ContextMiddleware(ContextHandler) ContextHandler - } - - type MixedContextService interface { - ContextService - - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - JSONContextMiddleware(JSONContextEndpoint) JSONContextEndpoint - } - -Where `JSONEndpoint`, `JSONContextEndpoint`, `ContextHandler` and `ContextHandlerFunc` are defined as: - - type JSONEndpoint func(*http.Request) (int, interface{}, error) - - type JSONContextEndpoint func(context.Context, *http.Request) (int, interface{}, error) - - type ContextHandler interface { - ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) - } - - type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request) - -Also, the one service type that works with an `RPCServer`: - - type RPCService interface { - Service - - Service() (grpc.ServiceDesc, interface{}) - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONContextEndpoints. - JSONMiddlware(JSONContextEndpoint) JSONContextEndpoint - } - -The `Middleware(..)` functions offer each service a 'hook' to wrap each of its endpoints. This may be handy for adding additional headers or context to the request. This is also the point where other, third-party middleware could be easily be plugged in (ie. oauth, tracing, metrics, logging, etc.) - -The `pubsub` package - -This package contains two generic interfaces for publishing data to queues and subscribing and consuming data from those queues. - - // Publisher is a generic interface to encapsulate how we want our publishers - // to behave. Until we find reason to change, we're forcing all publishers - // to emit protobufs. - type Publisher interface { - // Publish will publish a message. - Publish(ctx context.Context, key string, msg proto.Message) error - // Publish will publish a []byte message. - PublishRaw(ctx context.Context, key string, msg []byte) error - } - - // Subscriber is a generic interface to encapsulate how we want our subscribers - // to behave. For now the system will auto stop if it encounters any errors. If - // a user encounters a closed channel, they should check the Err() method to see - // what happened. - type Subscriber interface { - // Start will return a channel of raw messages - Start() <-chan SubscriberMessage - // Err will contain any errors returned from the consumer connection. - Err() error - // Stop will initiate a graceful shutdown of the subscriber connection - Stop() error - } - -Where a `SubscriberMessage` is an interface that gives implementations a hook for acknowledging/delete messages. Take a look at the docs for each implementation in `pubsub` to see how they behave. - -There are currently 3 implementations of each type of `pubsub` interfaces: - -For pubsub via Amazon's SNS/SQS, you can use the `pubsub/aws` package. - -For pubsub via Google's Pubsub, you can use the `pubsub/gcp` package. - -For pubsub via Kafka topics, you can use the `pubsub/kafka` package. - -For publishing via HTTP, you can use the `pubsub/http` package. - -The `pubsub/pubsubtest` package - -This package contains 'test' implementations of the `pubsub.Publisher` and `pubsub.Subscriber` interfaces that will allow developers to easily mock out and test their `pubsub` implementations: - - type TestPublisher struct { - // Published will contain a list of all messages that have been published. - Published []TestPublishMsg - - // GivenError will be returned by the TestPublisher on publish. - // Good for testing error scenarios. - GivenError error - - // FoundError will contain any errors encountered while marshalling - // the protobuf struct. - FoundError error - } - - type TestSubscriber struct { - // ProtoMessages will be marshalled into []byte used to mock out - // a feed if it is populated. - ProtoMessages []proto.Message - - // JSONMEssages will be marshalled into []byte and used to mock out - // a feed if it is populated. - JSONMessages []interface{} - - // GivenErrError will be returned by the TestSubscriber on Err(). - // Good for testing error scenarios. - GivenErrError error - - // GivenStopError will be returned by the TestSubscriber on Stop(). - // Good for testing error scenarios. - GivenStopError error - - // FoundError will contain any errors encountered while marshalling - // the JSON and protobuf struct. - FoundError error - } - -The `web` package - -This package contains a handful of very useful functions for parsing types from request queries and payloads. - -Examples - -For examples of how to use the gizmo `server` and `pubsub` packages, take a look at the 'examples' subdirectory. - -The Gizmo logo was based on the Go mascot designed by Renée French and copyrighted under the Creative Commons Attribution 3.0 license. -*/ -package gizmo diff --git a/vendor/github.com/NYTimes/gizmo/gitcookies.sh.enc b/vendor/github.com/NYTimes/gizmo/gitcookies.sh.enc deleted file mode 100644 index ba59a44a..00000000 --- a/vendor/github.com/NYTimes/gizmo/gitcookies.sh.enc +++ /dev/null @@ -1 +0,0 @@ -Fr��u�M���av����ܦ�HL�F�I�M�4���̪�n�ьJ�LI�\��4A 4]��i_����i���9�e�Z��µE��c��h��Y��-�U��Î�dk>&��=�zP(Rh$g���C�cYDO�.͌�M&l�Z�-�ý������?�q�g�����I ��ަTG�'���Mi�f:*������Q�+-��>��*2��L3��Y/Rkiy�2�j8٦��ۭ���/����1f%3�|e��r �[O̜� ��'��fsK��iߵD�ҕ��W�Ȍ5�J=s�+���B�Q�s,�J7�K|0 c���К��F�� ����J�b�º��$�fܓA���ښ�E^,,-�S��=��(�?�'ז��|B�Bg��Ⱥ]E}'�k�� U��VI� \ No newline at end of file diff --git a/vendor/github.com/NYTimes/gizmo/server/activity.go b/vendor/github.com/NYTimes/gizmo/server/activity.go deleted file mode 100644 index 91ea706e..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/activity.go +++ /dev/null @@ -1,38 +0,0 @@ -package server - -import "sync/atomic" - -// ActivityMonitor can be used to count and share the number of active requests. -type ActivityMonitor struct { - // counter for # of active requests - reqCount uint32 -} - -// NewActivityMonitor will return a new ActivityMonitor instance. -func NewActivityMonitor() *ActivityMonitor { - return &ActivityMonitor{} -} - -// Active returns true if there are requests currently in flight. -func (a *ActivityMonitor) Active() bool { - return a.NumActiveRequests() > 0 -} - -// CountRequest will increment the request count and signal -// the activity monitor to stay active. Call this in your server -// when you receive a request. -func (a *ActivityMonitor) CountRequest() { - atomic.AddUint32(&a.reqCount, 1) -} - -// UncountRequest will decrement the active request count. Best practice is to `defer` -// this function call directly after calling CountRequest(). -func (a *ActivityMonitor) UncountRequest() { - atomic.AddUint32(&a.reqCount, ^uint32(0)) -} - -// NumActiveRequests returns the number of in-flight requests currently -// running on this server. -func (a *ActivityMonitor) NumActiveRequests() uint32 { - return atomic.LoadUint32(&a.reqCount) -} diff --git a/vendor/github.com/NYTimes/gizmo/server/activity_test.go b/vendor/github.com/NYTimes/gizmo/server/activity_test.go deleted file mode 100644 index b3d7b159..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/activity_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package server - -import "testing" - -func TestActivityMonitorRequestCount(t *testing.T) { - a := NewActivityMonitor() - // test the active request count - a.CountRequest() // 1 - a.CountRequest() // 2 - a.CountRequest() // 3 - - if !a.Active() { - t.Error("ActivityMonitor is inactive when there should be 3 active requests") - } - - if active := a.NumActiveRequests(); active != 3 { - t.Errorf("ActivityMonitor expected 3 active request, got %d", active) - } - - a.UncountRequest() // 2 - - if active := a.NumActiveRequests(); active != 2 { - t.Errorf("ActivityMonitor expected 2 active request, got %d", active) - } - - if !a.Active() { - t.Error("ActivityMonitor is inactive when there should be 2 active requests") - } - - a.UncountRequest() // 1 - - if active := a.NumActiveRequests(); active != 1 { - t.Errorf("ActivityMonitor expected 1 active request, got %d", active) - } - - if !a.Active() { - t.Error("ActivityMonitor is inactive when there should be 1 active request") - } - - a.UncountRequest() // 0 - - if a.Active() { - t.Error("ActivityMonitor is active when there should be 0 active request") - } - -} diff --git a/vendor/github.com/NYTimes/gizmo/server/config.go b/vendor/github.com/NYTimes/gizmo/server/config.go deleted file mode 100644 index ee84dd1f..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/config.go +++ /dev/null @@ -1,170 +0,0 @@ -package server - -import ( - "flag" - "io" - "net/http" - "os" - - "github.com/NYTimes/logrotate" - "github.com/go-kit/kit/metrics/provider" - "github.com/gorilla/handlers" - - "github.com/NYTimes/gizmo/config" - "github.com/NYTimes/gizmo/config/metrics" -) - -// Config holds info required to configure a gizmo server.Server. -type Config struct { - // Server will tell the server package which type of server to init. If - // empty, this will default to 'simple'. - ServerType string `envconfig:"GIZMO_SERVER_TYPE"` - - // HealthCheckType is used by server to init the proper HealthCheckHandler. - // If empty, this will default to 'simple'. - HealthCheckType string `envconfig:"GIZMO_HEALTH_CHECK_TYPE"` - // HealthCheckPath is used by server to init the proper HealthCheckHandler. - // If empty, this will default to '/status.txt'. - HealthCheckPath string `envconfig:"GIZMO_HEALTH_CHECK_PATH"` - // CustomHealthCheckHandler will be used if HealthCheckType is set with "custom". - CustomHealthCheckHandler http.Handler - - // RouterType is used by the server to init the proper Router implementation. - // If empty, this will default to 'gorilla'. - RouterType string `envconfig:"GIZMO_ROUTER_TYPE"` - - // JSONContentType can be used to override the default JSONContentType. - JSONContentType *string `envconfig:"GIZMO_JSON_CONTENT_TYPE"` - // MaxHeaderBytes can be used to override the default MaxHeaderBytes (1<<20). - MaxHeaderBytes *int `envconfig:"GIZMO_JSON_CONTENT_TYPE"` - // ReadTimeout can be used to override the default http server timeout of 10s. - // The string should be formatted like a time.Duration string. - ReadTimeout *string `envconfig:"GIZMO_READ_TIMEOUT"` - // WriteTimeout can be used to override the default http server timeout of 10s. - // The string should be formatted like a time.Duration string. - WriteTimeout *string `envconfig:"GIZMO_WRITE_TIMEOUT"` - // IdleTimeout can be used to override the default http server timeout of 120s. - // The string should be formatted like a time.Duration string. This - // feature is supported only on Go 1.8+. - IdleTimeout *string `envconfig:"GIZMO_IDLE_TIMEOUT"` - - // GOMAXPROCS can be used to override the default GOMAXPROCS (runtime.NumCPU). - GOMAXPROCS *int `envconfig:"GIZMO_SERVER_GOMAXPROCS"` - - // HTTPAccessLog is the location of the http access log. If it is empty, - // no access logging will be done. - HTTPAccessLog *string `envconfig:"HTTP_ACCESS_LOG"` - // RPCAccessLog is the location of the RPC access log. If it is empty, - // no access logging will be done. - RPCAccessLog *string `envconfig:"RPC_ACCESS_LOG"` - - // HTTPPort is the port the server implementation will serve HTTP over. - HTTPPort int `envconfig:"HTTP_PORT"` - // RPCPort is the port the server implementation will serve RPC over. - RPCPort int `envconfig:"RPC_PORT"` - - // Log is the path to the application log. - Log string `envconfig:"APP_LOG"` - // LogLevel will override the default log level of 'info'. - LogLevel string `envconfig:"APP_LOG_LEVEL"` - // LogJSONFormat will override the default JSON formatting logic on the server. - // By default the Server will log in a JSON format only if the Log field - // is defined. - // If this field is set and true, the logrus JSONFormatter will be used. - LogJSONFormat *bool `envconfig:"APP_LOG_JSON_FMT"` - - // TLSCertFile is an optional string for enabling TLS in simple servers. - TLSCertFile *string `envconfig:"TLS_CERT"` - // TLSKeyFile is an optional string for enabling TLS in simple servers. - TLSKeyFile *string `envconfig:"TLS_KEY"` - - // NotFoundHandler will override the default server NotfoundHandler if set. - NotFoundHandler http.Handler - - // Enable pprof Profiling. Off by default. - EnablePProf bool `envconfig:"ENABLE_PPROF"` - - // Metrics encapsulates the configurations required for a Gizmo - // Server to emit metrics. If your application has additional metrics, - // you should provide a MetricsFactory instead. - Metrics metrics.Config - // MetricsProvider will override the default server metrics provider if set. - MetricsProvider provider.Provider - - // GraphiteHost is DEPRECATED. Please use the - // Metrics config with "Type":"graphite" and this - // value in the "Addr" field. - GraphiteHost *string `envconfig:"GRAPHITE_HOST"` - - // this flag is for internal use. mainly to tell the SimpleServer - // to act like it's on an App Engine Flexible VM. - appEngine bool -} - -// LoadConfigFromEnv will attempt to load a Server object -// from environment variables. If not populated, nil -// is returned. -func LoadConfigFromEnv() *Config { - var server Config - config.LoadEnvConfig(&server) - server.Metrics = metrics.LoadConfigFromEnv() - return &server -} - -// NewAccessLogMiddleware will wrap a logrotate-aware Apache-style access log handler -// around the given http.Handler if an access log location is provided by the config, -// or optionally send access logs to stdout. -func NewAccessLogMiddleware(logLocation *string, handler http.Handler) (http.Handler, error) { - if logLocation == nil { - return handler, nil - } - var lw io.Writer - var err error - switch *logLocation { - case "stdout": - lw = os.Stdout - default: - lw, err = logrotate.NewFile(*logLocation) - if err != nil { - return nil, err - } - } - return handlers.CombinedLoggingHandler(lw, handler), nil -} - -// SetConfigOverrides will check the *CLI variables for any values -// and override the values in the given config if they are set. -// If LogCLI is set to "dev", the given `Log` pointer will be set to an -// empty string. -func SetConfigOverrides(c *Config) { - // HTTPAccessLogCLI is a pointer to the value of the '-http-access-log' command line flag. It is meant to - // declare an access log location for HTTP services. - HTTPAccessLogCLI := flag.String("http-access-log", "", "HTTP access log location") - // RPCAccessLogCLI is a pointer to the value of the '-rpc-access-log' command line flag. It is meant to - // declare an acces log location for RPC services. - RPCAccessLogCLI := flag.String("rpc-access-log", "", "RPC access log location") - // HTTPPortCLI is a pointer to the value for the '-http' flag. It is meant to declare the port - // number to serve HTTP services. - HTTPPortCLI := flag.Int("http", 0, "Port to run an HTTP server on") - // RPCPortCLI is a pointer to the value for the '-rpc' flag. It is meant to declare the port - // number to serve RPC services. - RPCPortCLI := flag.Int("rpc", 0, "Port to run an RPC server on") - - config.SetLogOverride(&c.Log) - - if *HTTPAccessLogCLI != "" { - c.HTTPAccessLog = HTTPAccessLogCLI - } - - if *RPCAccessLogCLI != "" { - c.RPCAccessLog = RPCAccessLogCLI - } - - if *HTTPPortCLI > 0 { - c.HTTPPort = *HTTPPortCLI - } - - if *RPCPortCLI > 0 { - c.RPCPort = *RPCPortCLI - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/context_gorilla.go b/vendor/github.com/NYTimes/gizmo/server/context_gorilla.go deleted file mode 100644 index dfb850c4..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/context_gorilla.go +++ /dev/null @@ -1,48 +0,0 @@ -// +build !go1.7 - -package server - -import ( - "fmt" - "net/http" - - "github.com/gorilla/context" -) - -// AddIPToContext will attempt to pull an IP address out of the request and -// set it into a gorilla context. -func AddIPToContext(r *http.Request) { - ip, err := GetIP(r) - if err != nil { - LogWithFields(r).Warningf("unable to get IP: %s", err) - } else { - context.Set(r, "ip", ip) - } - - if ip = GetForwardedIP(r); len(ip) > 0 { - context.Set(r, "forward-for-ip", ip) - } -} - -// ContextFields will take a request and convert a context map to logrus Fields. -func ContextFields(r *http.Request) map[string]interface{} { - fields := map[string]interface{}{} - for k, v := range context.GetAll(r) { - strK := fmt.Sprintf("%+v", k) - typeK := fmt.Sprintf("%T-%+v", k, k) - // gorilla.mux adds the route to context. - // we want to remove it for now - if typeK == "mux.contextKey-1" || typeK == "mux.contextKey-0" { - continue - } - // web.varsKey for _all_ mux variables (gorilla or httprouter) - if typeK == "web.contextKey-2" { - strK = "muxvars" - } - fields[strK] = fmt.Sprintf("%#+v", v) - } - fields["path"] = r.URL.Path - fields["rawquery"] = r.URL.RawQuery - - return fields -} diff --git a/vendor/github.com/NYTimes/gizmo/server/context_native.go b/vendor/github.com/NYTimes/gizmo/server/context_native.go deleted file mode 100644 index de168926..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/context_native.go +++ /dev/null @@ -1,55 +0,0 @@ -// +build go1.7 - -package server - -import ( - "fmt" - "log" - "net/http" - - "github.com/NYTimes/gizmo/web" -) - -// AddIPToContext will attempt to pull an IP address out of the request and -// set it into a gorilla context. -func AddIPToContext(r *http.Request) { - ip, err := GetIP(r) - if err != nil { - LogWithFields(r).Warningf("unable to get IP: %s", err) - } else { - vars := web.Vars(r) - vars["ip"] = ip - web.SetRouteVars(r, vars) - } - - if ip = GetForwardedIP(r); len(ip) > 0 { - vars := web.Vars(r) - vars["forward-for-ip"] = ip - web.SetRouteVars(r, vars) - } -} - -// ContextFields will take a request and convert a context map to logrus Fields. -func ContextFields(r *http.Request) map[string]interface{} { - fields := map[string]interface{}{} - for k, v := range web.Vars(r) { - strK := fmt.Sprintf("%+v", k) - typeK := fmt.Sprintf("%T-%+v", k, k) - // gorilla.mux adds the route to context. - // we want to remove it for now - if typeK == "mux.contextKey-1" || typeK == "mux.contextKey-0" { - log.Print("mux key!?") - continue - } - // web.varsKey for _all_ mux variables (gorilla or httprouter) - if typeK == "web.contextKey-2" { - log.Print("muxvars key!?") - strK = "muxvars" - } - fields[strK] = fmt.Sprintf("%#+v", v) - } - fields["path"] = r.URL.Path - fields["rawquery"] = r.URL.RawQuery - - return fields -} diff --git a/vendor/github.com/NYTimes/gizmo/server/doc.go b/vendor/github.com/NYTimes/gizmo/server/doc.go deleted file mode 100644 index 84aa2f48..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/doc.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Package server is the bulk of the toolkit and relies on `server.Config` for any managing `Server` implementations. A server must implement the following interface: - - // Server is the basic interface that defines what expect from any server. - type Server interface { - Register(...Service) error - Start() error - Stop() error - } - -The package offers 2 server implementations: - -`SimpleServer`, which is capable of handling basic HTTP and JSON requests via 3 of the available `Service` implementations: `SimpleService`, `JSONService`, `ContextService`, `MixedService` and `MixedContextService`. A service and these implementations will be defined below. - -`RPCServer`, which is capable of serving a gRPC server on one port and JSON endpoints on another. This kind of server can only handle the `RPCService` implementation. - -The `Service` interface is minimal to allow for maximum flexibility: - - type Service interface { - Prefix() string - - // Middleware provides a hook for service-wide middleware - Middleware(http.Handler) http.Handler - } - -The 3 service types that are accepted and hostable on the `SimpleServer`: - - type SimpleService interface { - Service - - // router - method - func - Endpoints() map[string]map[string]http.HandlerFunc - } - - type JSONService interface { - Service - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONEndpoints. - JSONMiddleware(JSONEndpoint) JSONEndpoint - } - - type MixedService interface { - Service - - // route - method - func - Endpoints() map[string]map[string]http.HandlerFunc - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONEndpoints. - JSONMiddleware(JSONEndpoint) JSONEndpoint - } - - type ContextService interface { - Service - - // route - method - func - ContextEndpoints() map[string]map[string]ContextHandlerFunc - // ContextMiddleware provides a hook for service-wide middleware around ContextHandler - ContextMiddleware(ContextHandler) ContextHandler - } - - type MixedContextService interface { - ContextService - - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - JSONContextMiddleware(JSONContextEndpoint) JSONContextEndpoint - } - -Where `JSONEndpoint`, `JSONContextEndpoint`, `ContextHandler` and `ContextHandlerFunc` are defined as: - - type JSONEndpoint func(*http.Request) (int, interface{}, error) - - type JSONContextEndpoint func(context.Context, *http.Request) (int, interface{}, error) - - type ContextHandler interface { - ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) - } - - type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request) - -Also, the one service type that works with an `RPCServer`: - - type RPCService interface { - ContextService - - Service() (grpc.ServiceDesc, interface{}) - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - // JSONMiddleware provides a hook for service-wide middleware around JSONContextEndpoints. - JSONMiddlware(JSONContextEndpoint) JSONContextEndpoint - } - -The `Middleware(..)` functions offer each service a 'hook' to wrap each of its endpoints. This may be handy for adding additional headers or context to the request. This is also the point where other, third-party middleware could be easily be plugged in (ie. oauth, tracing, metrics, logging, etc.) - -Examples - -Check out the gizmo/examples/servers directory to see several reference implementations. -*/ -package server diff --git a/vendor/github.com/NYTimes/gizmo/server/esxhealthcheck.go b/vendor/github.com/NYTimes/gizmo/server/esxhealthcheck.go deleted file mode 100644 index b914b720..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/esxhealthcheck.go +++ /dev/null @@ -1,151 +0,0 @@ -package server - -import ( - "fmt" - "io" - "net/http" - "sync" - "sync/atomic" - "time" -) - -var ( - // ESXShutdownTimeout is the hard cut off kill the server while the ESXHealthCheck is waiting - // for the server to be inactive. - ESXShutdownTimeout = 180 * time.Second - // ESXShutdownPollInterval sets the duration for how long ESXHealthCheck will wait between - // each NumActiveRequests poll in WaitForZero. - ESXShutdownPollInterval = 1 * time.Second - // ESXLoadBalancerNotReadyDuration is the amount of time ESXHealthCheck will wait after - // sending a 'bad' status to the LB during a graceful shutdown. - ESXLoadBalancerNotReadyDuration = 15 * time.Second -) - -// ESXHealthCheck will manage the health checks and manage -// a server's load balanacer status. On Stop, it will block -// until all LBs have received a 'bad' status. -type ESXHealthCheck struct { - // ready flag health checks and graceful shutdown - // uint32 so we can use sync/atomic and no defers - ready uint32 - - // last LB status to know if LB knows we're inactive - lbNotReadyTime map[string]*time.Time - lbNotReadyTimeMu sync.RWMutex - - monitor *ActivityMonitor -} - -// NewESXHealthCheck returns a new instance of ESXHealthCheck. -func NewESXHealthCheck() *ESXHealthCheck { - return &ESXHealthCheck{ - lbNotReadyTime: map[string]*time.Time{}, - } -} - -// Path returns the default ESX health path. -func (e *ESXHealthCheck) Path() string { - return "/status.txt" -} - -// Start will set the monitor and flip the ready flag to 'True'. -func (e *ESXHealthCheck) Start(monitor *ActivityMonitor) error { - e.monitor = monitor - atomic.StoreUint32(&e.ready, 1) - return nil -} - -// Stop will set the flip the 'ready' flag and wait block until the server has removed itself -// from all load balancers. -func (e *ESXHealthCheck) Stop() error { - // fill the flag and wait - atomic.StoreUint32(&e.ready, 0) - if err := e.waitForZero(); err != nil { - Log.Errorf("server still active after %s, this will not be a graceful shutdown: %s", ESXShutdownTimeout, err) - return err - } - return nil -} - -// ServeHTTP will handle the health check requests on the server. ESXHealthCheck -// will return with an "ok" status as long as the ready flag is set to True. -// If a `deployer` query parameter is included, the request will not be counted -// as a load balancer. -func (e *ESXHealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if atomic.LoadUint32(&e.ready) == 1 { - if _, err := io.WriteString(w, "ok-"+Name); err != nil { - LogWithFields(r).Warn("unable to write healthcheck response: ", err) - } - e.updateReadyTime(r, true) - } else { - http.Error(w, "service unavailable", http.StatusServiceUnavailable) - e.updateReadyTime(r, false) - } -} - -func (e *ESXHealthCheck) updateReadyTime(r *http.Request, ready bool) { - ip, err := GetIP(r) - if err != nil { - Log.Warnf("status endpoint was unable to get LB IP addr: %s", err) - return - } - - if _, ok := r.URL.Query()["deployer"]; !ok { - e.lbNotReadyTimeMu.Lock() - if ready { - e.lbNotReadyTime[ip] = nil - } else { - if last := e.lbNotReadyTime[ip]; last == nil { - now := time.Now() - e.lbNotReadyTime[ip] = &now - Log.Infof("status endpoint has returned it's first not-ready status to: %s", ip) - } - } - e.lbNotReadyTimeMu.Unlock() - } -} - -func (e *ESXHealthCheck) lbActive() (active bool) { - e.lbNotReadyTimeMu.RLock() - defer e.lbNotReadyTimeMu.RUnlock() - for ip, notReadyTime := range e.lbNotReadyTime { - if notReadyTime == nil || time.Since(*notReadyTime) < ESXLoadBalancerNotReadyDuration { - Log.Infof("load balancer is still active: %s", ip) - return true - } - } - return false -} - -// waitForZero will continuously query Active and NumActiveRequests at the ShutdownPollInterval until the -// LB has seen a bad status, the server is not Actve and NumActiveRequests returns 0 or the timeout -// is reached. It will return error in case of timeout. -func (e *ESXHealthCheck) waitForZero() error { - to := time.After(ESXShutdownTimeout) - done := make(chan struct{}, 1) - go func() { - for { - if e.monitor.Active() || e.lbActive() { - Log.Info("server is still active") - } else { - Log.Info("server is no longer active") - reqs := e.monitor.NumActiveRequests() - if reqs == 0 { - done <- struct{}{} - break - } else { - Log.Info("server still has requests in flight. waiting longer...") - } - } - time.Sleep(ESXShutdownPollInterval) - } - }() - - select { - case <-done: - Log.Info("server is no longer receiving traffic") - return nil - case <-to: - return fmt.Errorf("server is still active after %s", ESXShutdownTimeout) - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/esxhealthcheck_test.go b/vendor/github.com/NYTimes/gizmo/server/esxhealthcheck_test.go deleted file mode 100644 index ec69dffb..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/esxhealthcheck_test.go +++ /dev/null @@ -1,242 +0,0 @@ -package server - -import ( - "net/http" - "net/http/httptest" - "strings" - "testing" - "time" -) - -func TestESXHealthCheckDeployer(t *testing.T) { - // changing so the tests don't take forever, but long enough so tests fail - ESXLoadBalancerNotReadyDuration = 10 * time.Second - - hc := NewESXHealthCheck() - am := NewActivityMonitor() - hc.Start(am) - - // setup an LB-like request with an easy IP header - lbIP := "1.1.1.1" - lbReq, _ := http.NewRequest("GET", hc.Path()+"?deployer=true", nil) - lbReq.Header.Add("X-Real-IP", lbIP) - - wr := httptest.NewRecorder() - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusOK { - t.Errorf("ESXHealthCheck expected 200 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); !strings.HasPrefix(gotBody, "ok-") { - t.Errorf("ESXHealthCheck expected response body to start with 'ok-', got %s", gotBody) - } - - // gorountine to make sure Stop actually stops on time - done := make(chan bool) - go func() { - stopped := make(chan bool) - go func() { - hc.Stop() - stopped <- true - }() - select { - case <-stopped: - case <-time.After(2 * time.Second): - t.Errorf("ESXHealthCheck.Stop() was still stopping after 2 seconds with no LBs checking!") - } - done <- true - }() - // give it a moment - time.Sleep(20 * time.Millisecond) - - wr = httptest.NewRecorder() - - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusServiceUnavailable { - t.Errorf("ESXHealthCheck expected 503 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); gotBody != "service unavailable\n" { - t.Errorf("ESXHealthCheck expected response body to start with 'service unavailable', got %s", gotBody) - } - - <-done -} - -func TestESXHealthCheckLB(t *testing.T) { - hc := NewESXHealthCheck() - am := NewActivityMonitor() - // changing so the tests don't take forever - ESXLoadBalancerNotReadyDuration = 1 * time.Second - - hc.Start(am) - - // setup an LB-like request with an easy IP header - lbIP := "1.1.1.1" - lbReq, _ := http.NewRequest("GET", hc.Path(), nil) - lbReq.Header.Add("X-Real-IP", lbIP) - - wr := httptest.NewRecorder() - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusOK { - t.Errorf("ESXHealthCheck expected 200 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); !strings.HasPrefix(gotBody, "ok-") { - t.Errorf("ESXHealthCheck expected response body to start with 'ok-', got %s", gotBody) - } - - // gorountine to make sure Stop actually stops on time - done := make(chan bool) - go func() { - stopped := make(chan bool) - go func() { - hc.Stop() - stopped <- true - }() - select { - case <-stopped: - case <-time.After(ESXLoadBalancerNotReadyDuration * (2 * time.Second)): - t.Errorf("ESXHealthCheck.Stop() was still stopping 2x after ESXLoadBalancerNotReadyDuration") - } - done <- true - }() - // give it a moment - time.Sleep(20 * time.Millisecond) - - // let the LB see a bad request - wr = httptest.NewRecorder() - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusServiceUnavailable { - t.Errorf("ESXHealthCheck expected 503 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); gotBody != "service unavailable\n" { - t.Errorf("ESXHealthCheck expected response body to start with 'service unavailable', got %s", gotBody) - } - - // wait for the healthcheck to stop - <-done -} - -func TestESXHealthCheckActiveRequests(t *testing.T) { - // changing so the tests don't take forever, but long enough so tests fail - ESXLoadBalancerNotReadyDuration = 5 * time.Second - ESXShutdownTimeout = 5 * time.Second - - hc := NewESXHealthCheck() - am := NewActivityMonitor() - hc.Start(am) - - // setup an LB-like request with an easy IP header - lbIP := "1.1.1.1" - lbReq, _ := http.NewRequest("GET", hc.Path(), nil) - lbReq.Header.Add("X-Real-IP", lbIP) - - wr := httptest.NewRecorder() - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusOK { - t.Errorf("ESXHealthCheck expected 200 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); !strings.HasPrefix(gotBody, "ok-") { - t.Errorf("ESXHealthCheck expected response body to start with 'ok-', got %s", gotBody) - } - - // WHOA, AN ACTIVE REQUEST ENTERS THE SCENE FROM STAGE LEFT! - am.CountRequest() - - // gorountine to make sure Stop actually stops on time - done := make(chan bool) - go func() { - stopped := make(chan bool) - go func() { - err := hc.Stop() - if err == nil { - t.Error("ESXHealthCheck expected a shutdown timeout error because there was an active request") - } - stopped <- true - }() - select { - case <-stopped: - case <-time.After(ESXShutdownTimeout * 2): - t.Errorf("ESXHealthCheck.Stop() was still stopping after 2 seconds with no LBs checking!") - } - done <- true - }() - // give it a moment - time.Sleep(20 * time.Millisecond) - - wr = httptest.NewRecorder() - - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusServiceUnavailable { - t.Errorf("ESXHealthCheck expected 503 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); gotBody != "service unavailable\n" { - t.Errorf("ESXHealthCheck expected response body to start with 'service unavailable', got %s", gotBody) - } - - <-done -} -func TestESXHealthCheckBadIP(t *testing.T) { - // changing so the tests don't take forever, but long enough so tests fail - ESXLoadBalancerNotReadyDuration = 10 * time.Second - - hc := NewESXHealthCheck() - am := NewActivityMonitor() - hc.Start(am) - - // setup an LB-like request with an easy IP header - lbReq, _ := http.NewRequest("GET", hc.Path(), nil) - - wr := httptest.NewRecorder() - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusOK { - t.Errorf("ESXHealthCheck expected 200 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); !strings.HasPrefix(gotBody, "ok-") { - t.Errorf("ESXHealthCheck expected response body to start with 'ok-', got %s", gotBody) - } - - // gorountine to make sure Stop actually stops on time - done := make(chan bool) - go func() { - stopped := make(chan bool) - go func() { - hc.Stop() - stopped <- true - }() - select { - case <-stopped: - case <-time.After(2 * time.Second): - t.Errorf("ESXHealthCheck.Stop() was still stopping after 2 seconds with no LBs checking!") - } - done <- true - }() - // give it a moment - time.Sleep(20 * time.Millisecond) - - wr = httptest.NewRecorder() - - hc.ServeHTTP(wr, lbReq) - - if wr.Code != http.StatusServiceUnavailable { - t.Errorf("ESXHealthCheck expected 503 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); gotBody != "service unavailable\n" { - t.Errorf("ESXHealthCheck expected response body to start with 'service unavailable', got %s", gotBody) - } - - <-done -} diff --git a/vendor/github.com/NYTimes/gizmo/server/healthcheck.go b/vendor/github.com/NYTimes/gizmo/server/healthcheck.go deleted file mode 100644 index 907378a3..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/healthcheck.go +++ /dev/null @@ -1,84 +0,0 @@ -package server - -import ( - "io" - "net/http" -) - -// HealthCheckHandler is an interface used by SimpleServer and RPCServer -// to allow users to customize their service's health check. Start will be -// called just before server start up and the given ActivityMonitor should -// offer insite to the # of requests in flight, if needed. -// Stop will be called once the servers receive a kill signal. -type HealthCheckHandler interface { - http.Handler - Path() string - Start(*ActivityMonitor) error - Stop() error -} - -// SimpleHealthCheck is a basic HealthCheckHandler implementation -// that _always_ returns with an "ok" status and shuts down immediately. -type SimpleHealthCheck struct { - path string -} - -// NewSimpleHealthCheck will return a new SimpleHealthCheck instance. -func NewSimpleHealthCheck(path string) *SimpleHealthCheck { - return &SimpleHealthCheck{path: path} -} - -// Path will return the configured status path to server on. -func (s *SimpleHealthCheck) Path() string { - return s.path -} - -// Start will do nothing. -func (s *SimpleHealthCheck) Start(monitor *ActivityMonitor) error { - return nil -} - -// Stop will do nothing and return nil. -func (s *SimpleHealthCheck) Stop() error { - return nil -} - -// ServeHTTP will always respond with "ok-"+server.Name. -func (s *SimpleHealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if _, err := io.WriteString(w, "ok-"+Name); err != nil { - LogWithFields(r).Warn("unable to write healthcheck response: ", err) - } -} - -// NewCustomHealthCheck will return a new CustomHealthCheck with the given -// path and handler. -func NewCustomHealthCheck(path string, handler http.Handler) *CustomHealthCheck { - return &CustomHealthCheck{path, handler} -} - -// CustomHealthCheck is a HealthCheckHandler that uses -// a custom http.Handler provided to the server via `config.CustomHealthCheckHandler`. -type CustomHealthCheck struct { - path string - handler http.Handler -} - -// Path will return the configured status path to server on. -func (c *CustomHealthCheck) Path() string { - return c.path -} - -// Start will do nothing. -func (c *CustomHealthCheck) Start(monitor *ActivityMonitor) error { - return nil -} - -// Stop will do nothing and return nil. -func (c *CustomHealthCheck) Stop() error { - return nil -} - -// ServeHTTP will allow the custom handler to manage the request and response. -func (c *CustomHealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request) { - c.handler.ServeHTTP(w, r) -} diff --git a/vendor/github.com/NYTimes/gizmo/server/healthcheck_test.go b/vendor/github.com/NYTimes/gizmo/server/healthcheck_test.go deleted file mode 100644 index e562231d..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/healthcheck_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package server - -import ( - "net/http" - "net/http/httptest" - "strings" - "testing" -) - -func TestSimpleHealthCheck(t *testing.T) { - path := "/status.txt" - s := NewSimpleHealthCheck(path) - a := NewActivityMonitor() - s.Start(a) - - req, _ := http.NewRequest("GET", path, nil) - wr := httptest.NewRecorder() - - s.ServeHTTP(wr, req) - - if wr.Code != http.StatusOK { - t.Errorf("SimpleHealthCheck expected 200 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); !strings.HasPrefix(gotBody, "ok-") { - t.Errorf("SimpleHealthCheck expected response body to start with 'ok-', got %s", gotBody) - } - - s.Stop() - - wr = httptest.NewRecorder() - - s.ServeHTTP(wr, req) - - if wr.Code != http.StatusOK { - t.Errorf("SimpleHealthCheck expected 200 response code, got %d", wr.Code) - } - - if gotBody := wr.Body.String(); !strings.HasPrefix(gotBody, "ok-") { - t.Errorf("SimpleHealthCheck expected response body to start with 'ok-', got %s", gotBody) - } - -} diff --git a/vendor/github.com/NYTimes/gizmo/server/http_server.go b/vendor/github.com/NYTimes/gizmo/server/http_server.go deleted file mode 100644 index 4177af40..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/http_server.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build !go1.8 - -package server - -import "net/http" - -func httpServer(handler http.Handler) *http.Server { - return &http.Server{ - Handler: handler, - MaxHeaderBytes: maxHeaderBytes, - ReadTimeout: readTimeout, - WriteTimeout: writeTimeout, - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/http_server_go18.go b/vendor/github.com/NYTimes/gizmo/server/http_server_go18.go deleted file mode 100644 index a8fdf7c3..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/http_server_go18.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build go1.8 - -package server - -import "net/http" - -func httpServer(handler http.Handler) *http.Server { - return &http.Server{ - Handler: handler, - MaxHeaderBytes: maxHeaderBytes, - ReadTimeout: readTimeout, - WriteTimeout: writeTimeout, - IdleTimeout: idleTimeout, - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/metrics.go b/vendor/github.com/NYTimes/gizmo/server/metrics.go deleted file mode 100644 index fd201e07..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/metrics.go +++ /dev/null @@ -1,157 +0,0 @@ -package server - -import ( - "bufio" - "errors" - "expvar" - "fmt" - "net" - "net/http" - "strings" - "time" - - "github.com/go-kit/kit/metrics" - "github.com/go-kit/kit/metrics/provider" - "github.com/prometheus/client_golang/prometheus" -) - -func expvarHandler(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=utf-8") - fmt.Fprintf(w, "{\n") - first := true - expvar.Do(func(kv expvar.KeyValue) { - if !first { - fmt.Fprintf(w, ",\n") - } - first = false - fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value) - }) - fmt.Fprintf(w, "\n}\n") -} - -// metricsResponseWriter grabs the StatusCode. -type metricsResponseWriter struct { - w http.ResponseWriter - StatusCode int -} - -func newMetricsResponseWriter(w http.ResponseWriter) *metricsResponseWriter { - return &metricsResponseWriter{w: w} -} - -func (w *metricsResponseWriter) Write(b []byte) (int, error) { - return w.w.Write(b) -} - -func (w *metricsResponseWriter) Header() http.Header { - return w.w.Header() -} - -func (w *metricsResponseWriter) WriteHeader(h int) { - w.StatusCode = h - w.w.WriteHeader(h) -} - -func (w *metricsResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { - h, ok := w.w.(http.Hijacker) - if !ok { - return nil, nil, errors.New("response writer does not implement hijacker") - } - return h.Hijack() -} - -// CounterByStatusXX is an http.Handler that counts responses by the first -// digit of their HTTP status code via go-kit/kit/metrics. -type CounterByStatusXX struct { - counter1xx, counter2xx, counter3xx, counter4xx, counter5xx metrics.Counter - handler http.Handler -} - -// CountedByStatusXX returns an http.Handler that passes requests to an -// underlying http.Handler and then counts the response by the first digit of -// its HTTP status code via go-kit/kit/metrics. -func CountedByStatusXX(handler http.Handler, name string, p provider.Provider) *CounterByStatusXX { - return &CounterByStatusXX{ - counter1xx: p.NewCounter(fmt.Sprintf("%s-1xx", name)), - counter2xx: p.NewCounter(fmt.Sprintf("%s-2xx", name)), - counter3xx: p.NewCounter(fmt.Sprintf("%s-3xx", name)), - counter4xx: p.NewCounter(fmt.Sprintf("%s-4xx", name)), - counter5xx: p.NewCounter(fmt.Sprintf("%s-5xx", name)), - handler: handler, - } -} - -// ServeHTTP passes the request to the underlying http.Handler and then counts -// the response by its HTTP status code via go-kit/kit/metrics. -func (c *CounterByStatusXX) ServeHTTP(w0 http.ResponseWriter, r *http.Request) { - w := newMetricsResponseWriter(w0) - c.handler.ServeHTTP(w, r) - if w.StatusCode < 200 { - c.counter1xx.Add(1) - } else if w.StatusCode < 300 { - c.counter2xx.Add(1) - } else if w.StatusCode < 400 { - c.counter3xx.Add(1) - } else if w.StatusCode < 500 { - c.counter4xx.Add(1) - } else { - c.counter5xx.Add(1) - } -} - -// Timer is an http.Handler that counts requests via go-kit/kit/metrics. -type Timer struct { - metrics.Histogram - isProm bool - handler http.Handler -} - -// Timed returns an http.Handler that starts a timer, passes requests to an -// underlying http.Handler, stops the timer, and updates the timer via -// go-kit/kit/metrics. -func Timed(handler http.Handler, name string, p provider.Provider) *Timer { - return &Timer{ - Histogram: p.NewHistogram(name, 50), - handler: handler, - } -} - -// ServeHTTP starts a timer, passes the request to the underlying http.Handler, -// stops the timer, and updates the timer via go-kit/kit/metrics. -func (t *Timer) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if !t.isProm { - defer func(start time.Time) { - t.Observe(time.Since(start).Seconds()) - }(time.Now()) - } - t.handler.ServeHTTP(w, r) -} - -func metricName(fullPath, method string) string { - // replace slashes - fullPath = strings.Replace(fullPath, "/", "-", -1) - // replace periods - fullPath = strings.Replace(fullPath, ".", "-", -1) - return fmt.Sprintf("routes.%s-%s", fullPath, method) -} - -// TimedAndCounted wraps a http.Handler with Timed and a CountedByStatusXXX or, if the -// metrics provider is of type Prometheus, via a prometheus.InstrumentHandler -func TimedAndCounted(handler http.Handler, fullPath string, method string, p provider.Provider) *Timer { - fullPath = strings.TrimPrefix(fullPath, "/") - switch fmt.Sprintf("%T", p) { - case "*provider.prometheusProvider": - return PrometheusTimedAndCounted(handler, fullPath) - default: - mn := metricName(fullPath, method) - return Timed(CountedByStatusXX(handler, mn+".STATUS-COUNT", p), mn+".DURATION", p) - } -} - -// PrometheusTimedAndCounted wraps a http.Handler with via prometheus.InstrumentHandler -func PrometheusTimedAndCounted(handler http.Handler, name string) *Timer { - return &Timer{ - isProm: true, - handler: prometheus.InstrumentHandler(name, handler), - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/metrics_test.go b/vendor/github.com/NYTimes/gizmo/server/metrics_test.go deleted file mode 100644 index d872b791..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/metrics_test.go +++ /dev/null @@ -1,187 +0,0 @@ -package server - -import ( - "bytes" - "io/ioutil" - "net/http" - "net/http/httptest" - "sync" - "testing" - "time" - - "github.com/go-kit/kit/metrics" -) - -func TestCounterByStatusXX(t *testing.T) { - tests := []int{111, 222, 333, 444, 555} - statuses := make(chan int, 1) - provider := newMockProvider() - - counter := CountedByStatusXX(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - status := <-statuses - w.WriteHeader(status) - if bod, _ := ioutil.ReadAll(r.Body); string(bod) != "blah" { - t.Errorf("CountedByStatusXX expected the request body to be 'blah', got '%s'", string(bod)) - } - r.Body.Close() - }), "counted", provider) - - for _, given := range tests { - statuses <- given - w := httptest.NewRecorder() - r, _ := http.NewRequest("POST", "http://yup.com/foo", bytes.NewBufferString("blah")) - counter.ServeHTTP(w, r) - if given != w.Code { - t.Errorf("CountedByStatusXX expected response code of %d, got %d", given, w.Code) - } - } - - close(statuses) - - if cnt := provider.counters["counted-1xx"].lastAdd; cnt != 1 { - t.Errorf("CountedByStatusXX expected 1xx counter to have a count of 1, got %f", cnt) - } - if cnt := provider.counters["counted-2xx"].lastAdd; cnt != 1 { - t.Errorf("CountedByStatusXX expected 2xx counter to have a count of 1, got %f", cnt) - } - if cnt := provider.counters["counted-3xx"].lastAdd; cnt != 1 { - t.Errorf("CountedByStatusXX expected 3xx counter to have a count of 1, got %f", cnt) - } - if cnt := provider.counters["counted-4xx"].lastAdd; cnt != 1 { - t.Errorf("CountedByStatusXX expected 4xx counter to have a count of 1, got %f", cnt) - } - if cnt := provider.counters["counted-5xx"].lastAdd; cnt != 1 { - t.Errorf("CountedByStatusXX expected 5xx counter to have a count of 1, got %f", cnt) - } -} - -func TestTimer(t *testing.T) { - provider := newMockProvider() - - r, _ := http.NewRequest("POST", "http://uhhuh.io/", bytes.NewBufferString("yerp")) - timer := Timed(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - time.Sleep(200 * time.Millisecond) - w.WriteHeader(http.StatusOK) - if bod, _ := ioutil.ReadAll(r.Body); string(bod) != "yerp" { - t.Errorf("Timer expected the request body to be 'yerp', got '%s'", string(bod)) - } - r.Body.Close() - }), "timed", provider) - w := httptest.NewRecorder() - timer.ServeHTTP(w, r) - - if dur := provider.histograms["timed"].lastObserved; dur < 0.2 || dur > 0.3 { - t.Errorf("Timer expected Max() to return between 200 and 300 ms, got %f", dur) - } -} - -func newMockProvider() *mockProvider { - return &mockProvider{ - counters: map[string]*mockCounter{}, - histograms: map[string]*mockHistogram{}, - gauges: map[string]*mockGauge{}, - } -} - -type mockProvider struct { - mtx sync.Mutex - counters map[string]*mockCounter - gauges map[string]*mockGauge - histograms map[string]*mockHistogram -} - -func (p *mockProvider) NewCounter(name string) metrics.Counter { - p.mtx.Lock() - defer p.mtx.Unlock() - c := &mockCounter{} - p.counters[name] = c - return c -} - -func (p *mockProvider) NewHistogram(name string, buckets int) metrics.Histogram { - p.mtx.Lock() - defer p.mtx.Unlock() - h := &mockHistogram{} - p.histograms[name] = h - return h -} - -func (p *mockProvider) NewGauge(name string) metrics.Gauge { - p.mtx.Lock() - defer p.mtx.Unlock() - g := &mockGauge{} - p.gauges[name] = g - return g -} - -func (p *mockProvider) Stop() { -} - -func (c *mockCounter) Name() string { - panic("not implemented") -} - -type mockCounter struct { - mtx sync.Mutex - lastAdd float64 -} - -func (c *mockCounter) With(labelValues ...string) metrics.Counter { - panic("not implemented") -} - -func (c *mockCounter) Add(delta float64) { - c.mtx.Lock() - defer c.mtx.Unlock() - c.lastAdd = delta -} - -type mockGauge struct { - mtx sync.Mutex - lastSet float64 - lastDelta float64 -} - -func (g *mockGauge) Name() string { - panic("not implemented") -} - -func (g *mockGauge) With(labelValues ...string) metrics.Gauge { - panic("not implemented") -} - -func (g *mockGauge) Set(value float64) { - g.mtx.Lock() - defer g.mtx.Unlock() - g.lastSet = value -} - -func (g *mockGauge) Add(delta float64) { - g.mtx.Lock() - defer g.mtx.Unlock() - g.lastDelta = delta - -} - -func (g *mockGauge) Get() float64 { - panic("not implemented") -} - -type mockHistogram struct { - mtx sync.Mutex - lastObserved float64 -} - -func (h *mockHistogram) Name() string { - panic("not implemented") -} - -func (h *mockHistogram) With(labelValues ...string) metrics.Histogram { - panic("not implemented") -} - -func (h *mockHistogram) Observe(value float64) { - h.mtx.Lock() - defer h.mtx.Unlock() - h.lastObserved = value -} diff --git a/vendor/github.com/NYTimes/gizmo/server/middleware.go b/vendor/github.com/NYTimes/gizmo/server/middleware.go deleted file mode 100644 index c94f2d34..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/middleware.go +++ /dev/null @@ -1,125 +0,0 @@ -package server - -import ( - "bytes" - "encoding/json" - "net/http" - "strings" -) - -// JSONToHTTP is the middleware func to convert a JSONEndpoint to -// an http.HandlerFunc. -func JSONToHTTP(ep JSONEndpoint) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Body != nil { - defer func() { - if err := r.Body.Close(); err != nil { - Log.Warn("unable to close request body: ", err) - } - }() - } - // it's JSON, so always set that content type - w.Header().Set("Content-Type", jsonContentType) - // prepare to grab the response from the ep - var b bytes.Buffer - encoder := json.NewEncoder(&b) - - // call the func and return err or not - code, res, err := ep(r) - w.WriteHeader(code) - if err != nil { - res = err - } - - err = encoder.Encode(res) - if err != nil { - LogWithFields(r).Error("unable to JSON encode response: ", err) - } - - if _, err := w.Write(b.Bytes()); err != nil { - LogWithFields(r).Warn("unable to write response: ", err) - } - }) -} - -// CORSHandler is a middleware func for setting all headers that enable CORS. -// If an originSuffix is provided, a strings.HasSuffix check will be performed -// before adding any CORS header. If an empty string is provided, any Origin -// header found will be placed into the CORS header. If no Origin header is -// found, no headers will be added. -func CORSHandler(f http.Handler, originSuffix string) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - origin := r.Header.Get("Origin") - if origin != "" && - (originSuffix == "" || strings.HasSuffix(origin, originSuffix)) { - w.Header().Set("Access-Control-Allow-Origin", origin) - w.Header().Set("Access-Control-Allow-Credentials", "true") - w.Header().Set("Access-Control-Allow-Headers", "Content-Type, x-requested-by, *") - w.Header().Set("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS") - } - f.ServeHTTP(w, r) - }) -} - -// NoCacheHandler is a middleware func for setting the Cache-Control to no-cache. -func NoCacheHandler(f http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") - w.Header().Set("Pragma", "no-cache") - w.Header().Set("Expires", "0") - f.ServeHTTP(w, r) - }) -} - -// JSONPHandler is a middleware func for wrapping response body with JSONP. -func JSONPHandler(f http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // using a custom ResponseWriter so we can - // capture the response of the main request, - // wrap our JSONP stuff around it - // and only write to the actual response once - jw := &jsonpResponseWriter{w: w} - f.ServeHTTP(jw, r) - - // add the JSONP only if the callback exists - callbackLabel := r.FormValue("callback") - if callbackLabel != "" { - var result []byte - result = append(jsonpStart, []byte(callbackLabel)...) - result = append(result, jsonpSecond...) - result = append(result, jw.buf.Bytes()...) - result = append(result, jsonpEnd...) - if _, err := w.Write(result); err != nil { - LogWithFields(r).Warn("unable to write JSONP response: ", err) - } - } else { - // if no callback, just write the bytes - if _, err := w.Write(jw.buf.Bytes()); err != nil { - LogWithFields(r).Warn("unable to write response: ", err) - } - } - }) -} - -var ( - jsonpStart = []byte("/**/") - jsonpSecond = []byte("(") - jsonpEnd = []byte(");") -) - -type jsonpResponseWriter struct { - w http.ResponseWriter - buf bytes.Buffer -} - -func (w *jsonpResponseWriter) Header() http.Header { - return w.w.Header() -} - -func (w *jsonpResponseWriter) WriteHeader(h int) { - w.w.WriteHeader(h) -} - -func (w *jsonpResponseWriter) Write(b []byte) (int, error) { - return w.buf.Write(b) -} diff --git a/vendor/github.com/NYTimes/gizmo/server/middleware_go17.go b/vendor/github.com/NYTimes/gizmo/server/middleware_go17.go deleted file mode 100644 index 59f1324d..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/middleware_go17.go +++ /dev/null @@ -1,74 +0,0 @@ -// +build go1.7 - -package server - -import ( - "bytes" - "context" - "encoding/json" - "net/http" -) - -// JSONContextToHTTP is a middleware func to convert a ContextHandler an http.Handler. -func JSONContextToHTTP(ep JSONContextEndpoint) ContextHandler { - return ContextHandlerFunc(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { - if r.Body != nil { - defer func() { - if err := r.Body.Close(); err != nil { - } - }() - } - // it's JSON, so always set that content type - w.Header().Set("Content-Type", jsonContentType) - // prepare to grab the response from the ep - var b bytes.Buffer - encoder := json.NewEncoder(&b) - - // call the func and return err or not - code, res, err := ep(ctx, r) - w.WriteHeader(code) - if err != nil { - res = err - } - - err = encoder.Encode(res) - if err != nil { - LogWithFields(r).Error("unable to JSON encode response: ", err) - } - - if _, err := w.Write(b.Bytes()); err != nil { - LogWithFields(r).Warn("unable to write response: ", err) - } - }) -} - -// ContextToHTTP is a middleware func to convert a ContextHandler an http.Handler. -func ContextToHTTP(ep ContextHandler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - ep.ServeHTTPContext(r.Context(), w, r) - }) -} - -// WithCloseHandler returns a Handler cancelling the context when the client -// connection close unexpectedly. -func WithCloseHandler(h ContextHandler) ContextHandler { - return ContextHandlerFunc(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { - // Cancel the context if the client closes the connection - if wcn, ok := w.(http.CloseNotifier); ok { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - - notify := wcn.CloseNotify() - go func() { - select { - case <-notify: - cancel() - case <-ctx.Done(): - } - }() - } - - h.ServeHTTPContext(ctx, w, r) - }) -} diff --git a/vendor/github.com/NYTimes/gizmo/server/middleware_pre_go17.go b/vendor/github.com/NYTimes/gizmo/server/middleware_pre_go17.go deleted file mode 100644 index d5fe9db8..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/middleware_pre_go17.go +++ /dev/null @@ -1,75 +0,0 @@ -// +build !go1.7 - -package server - -import ( - "bytes" - "encoding/json" - "net/http" - - "golang.org/x/net/context" -) - -// JSONContextToHTTP is a middleware func to convert a ContextHandler an http.Handler. -func JSONContextToHTTP(ep JSONContextEndpoint) ContextHandler { - return ContextHandlerFunc(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { - if r.Body != nil { - defer func() { - if err := r.Body.Close(); err != nil { - } - }() - } - // it's JSON, so always set that content type - w.Header().Set("Content-Type", jsonContentType) - // prepare to grab the response from the ep - var b bytes.Buffer - encoder := json.NewEncoder(&b) - - // call the func and return err or not - code, res, err := ep(ctx, r) - w.WriteHeader(code) - if err != nil { - res = err - } - - err = encoder.Encode(res) - if err != nil { - LogWithFields(r).Error("unable to JSON encode response: ", err) - } - - if _, err := w.Write(b.Bytes()); err != nil { - LogWithFields(r).Warn("unable to write response: ", err) - } - }) -} - -// ContextToHTTP is a middleware func to convert a ContextHandler an http.Handler. -func ContextToHTTP(ep ContextHandler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - ep.ServeHTTPContext(context.Background(), w, r) - }) -} - -// WithCloseHandler returns a Handler cancelling the context when the client -// connection close unexpectedly. -func WithCloseHandler(h ContextHandler) ContextHandler { - return ContextHandlerFunc(func(ctx context.Context, w http.ResponseWriter, r *http.Request) { - // Cancel the context if the client closes the connection - if wcn, ok := w.(http.CloseNotifier); ok { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - - notify := wcn.CloseNotify() - go func() { - select { - case <-notify: - cancel() - case <-ctx.Done(): - } - }() - } - - h.ServeHTTPContext(ctx, w, r) - }) -} diff --git a/vendor/github.com/NYTimes/gizmo/server/middleware_test.go b/vendor/github.com/NYTimes/gizmo/server/middleware_test.go deleted file mode 100644 index 5aea90bf..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/middleware_test.go +++ /dev/null @@ -1,179 +0,0 @@ -package server - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - "testing" -) - -func TestCORSHandler(t *testing.T) { - tests := []struct { - given string - givenPrefix string - - wantOrigin string - wantCreds string - wantHeaders string - wantMethods string - }{ - { - "", - "", - "", - "", - "", - "", - }, - { - ".nytimes.com.", - "", - ".nytimes.com.", - "true", - "Content-Type, x-requested-by, *", - "GET, PUT, POST, DELETE, OPTIONS", - }, - { - ".nytimes.com.", - "blah.com", - "", - "", - "", - "", - }, - } - - for _, test := range tests { - r, _ := http.NewRequest("GET", "", nil) - r.Header.Add("Origin", test.given) - w := httptest.NewRecorder() - - CORSHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - }), test.givenPrefix).ServeHTTP(w, r) - - if got := w.Header().Get("Access-Control-Allow-Origin"); got != test.wantOrigin { - t.Errorf("expected CORS origin header to be '%#v', got '%#v'", test.wantOrigin, got) - } - if got := w.Header().Get("Access-Control-Allow-Credentials"); got != test.wantCreds { - t.Errorf("expected CORS creds header to be '%#v', got '%#v'", test.wantCreds, got) - } - if got := w.Header().Get("Access-Control-Allow-Headers"); got != test.wantHeaders { - t.Errorf("expected CORS 'headers' header to be '%#v', got '%#v'", test.wantHeaders, got) - } - if got := w.Header().Get("Access-Control-Allow-Methods"); got != test.wantMethods { - t.Errorf("expected CORS 'methods' header to be '%#v', got '%#v'", test.wantMethods, got) - } - } -} - -func TestJSONToHTTP(t *testing.T) { - tests := []struct { - given JSONEndpoint - givenBody io.Reader - - wantCode int - wantBody string - }{ - { - JSONEndpoint(func(r *http.Request) (int, interface{}, error) { - bod, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Error("unable to read given request body: ", err) - } - if string(bod) != "yup" { - t.Errorf("expected 'yup', got %+v", string(bod)) - } - return http.StatusOK, struct{ Howdy string }{"Hi"}, nil - }), - bytes.NewBufferString("yup"), - http.StatusOK, - "{\"Howdy\":\"Hi\"}\n", - }, - { - JSONEndpoint(func(r *http.Request) (int, interface{}, error) { - return http.StatusServiceUnavailable, nil, &testJSONError{"nope"} - }), - nil, - http.StatusServiceUnavailable, - "{\"error\":\"nope\"}\n", - }, - } - - for _, test := range tests { - r, _ := http.NewRequest("GET", "", test.givenBody) - w := httptest.NewRecorder() - JSONToHTTP(test.given).ServeHTTP(w, r) - - if w.Code != test.wantCode { - t.Errorf("expected status code %d, got %d", test.wantCode, w.Code) - } - if gotHdr := w.Header().Get("Content-Type"); gotHdr != jsonContentType { - t.Errorf("expected Content-Type header of '%#v', got '%#v'", jsonContentType, gotHdr) - } - if got := w.Body.String(); got != test.wantBody { - t.Errorf("expected body of '%#v', got '%#v'", test.wantBody, got) - } - } -} - -type testJSONError struct { - Err string `json:"error"` -} - -func (t *testJSONError) Error() string { - return t.Err -} - -func TestJSONPHandler(t *testing.T) { - r, _ := http.NewRequest("GET", "", nil) - r.Form = url.Values{"callback": {"harumph"}} - w := httptest.NewRecorder() - - JSONPHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("{\"jsonp\":\"sucks\"}")) - })).ServeHTTP(w, r) - - want := `/**/harumph({"jsonp":"sucks"});` - if got := w.Body.String(); got != want { - t.Errorf("expected JSONP response of '%#v', got '%#v'", want, got) - } - - // once again, without a callback - r, _ = http.NewRequest("GET", "", nil) - w = httptest.NewRecorder() - - JSONPHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("{\"jsonp\":\"sucks\"}")) - })).ServeHTTP(w, r) - - want = `{"jsonp":"sucks"}` - if got := w.Body.String(); got != want { - t.Errorf("expected JSONP response of '%#v', got '%#v'", want, got) - } -} - -func TestNoCacheHandler(t *testing.T) { - r, _ := http.NewRequest("GET", "", nil) - w := httptest.NewRecorder() - - NoCacheHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - })).ServeHTTP(w, r) - - want := "no-cache, no-store, must-revalidate" - if got := w.Header().Get("Cache-Control"); got != want { - t.Errorf("expected no-cache control header to be '%#v', got '%#v'", want, got) - } - want = "no-cache" - if got := w.Header().Get("Pragma"); got != want { - t.Errorf("expected no-cache pragma header to be '%#v', got '%#v'", want, got) - } - want = "0" - if got := w.Header().Get("Expires"); got != want { - t.Errorf("expected no-cache Expires header to be '%#v', got '%#v'", want, got) - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/router.go b/vendor/github.com/NYTimes/gizmo/server/router.go deleted file mode 100644 index efed9ed3..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/router.go +++ /dev/null @@ -1,110 +0,0 @@ -package server - -import ( - "net/http" - - "github.com/gorilla/mux" - "github.com/julienschmidt/httprouter" - - "github.com/NYTimes/gizmo/web" -) - -// Router is an interface to wrap different router types to be embedded within -// Gizmo server.Server implementations. -type Router interface { - Handle(method string, path string, handler http.Handler) - HandleFunc(method string, path string, handlerFunc func(http.ResponseWriter, *http.Request)) - ServeHTTP(w http.ResponseWriter, r *http.Request) - SetNotFoundHandler(handler http.Handler) -} - -// NewRouter will return the router specified by the server -// config. If no Router value is supplied, the server -// will default to using Gorilla mux. -func NewRouter(cfg *Config) Router { - switch cfg.RouterType { - case "fast", "httprouter": - return &FastRouter{httprouter.New()} - case "gorilla": - return &GorillaRouter{mux.NewRouter()} - default: - return &GorillaRouter{mux.NewRouter()} - } -} - -// GorillaRouter is a Router implementation for the Gorilla web toolkit's `mux.Router`. -type GorillaRouter struct { - mux *mux.Router -} - -// Handle will call the Gorilla web toolkit's Handle().Method() methods. -func (g *GorillaRouter) Handle(method, path string, h http.Handler) { - g.mux.Handle(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // copy the route params into a shared location - // duplicating memory, but allowing Gizmo to be more flexible with - // router implementations. - web.SetRouteVars(r, mux.Vars(r)) - h.ServeHTTP(w, r) - })).Methods(method) -} - -// HandleFunc will call the Gorilla web toolkit's HandleFunc().Method() methods. -func (g *GorillaRouter) HandleFunc(method, path string, h func(http.ResponseWriter, *http.Request)) { - g.Handle(method, path, http.HandlerFunc(h)) -} - -// SetNotFoundHandler will set the Gorilla mux.Router.NotFoundHandler. -func (g *GorillaRouter) SetNotFoundHandler(h http.Handler) { - g.mux.NotFoundHandler = h -} - -// ServeHTTP will call Gorilla mux.Router.ServerHTTP directly. -func (g *GorillaRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { - g.mux.ServeHTTP(w, r) -} - -// FastRouter is a Router implementation for `julienschmidt/httprouter`. -type FastRouter struct { - mux *httprouter.Router -} - -// Handle will call the `httprouter.METHOD` methods and use the HTTPToFastRoute -// to pass httprouter.Params into a Gorilla request context. The params will be available -// via the `FastRouterVars` function. -func (f *FastRouter) Handle(method, path string, h http.Handler) { - f.mux.Handle(method, path, HTTPToFastRoute(h)) -} - -// HandleFunc will call the `httprouter.METHOD` methods and use the HTTPToFastRoute -// to pass httprouter.Params into a Gorilla request context. The params will be available -// via the `FastRouterVars` function. -func (f *FastRouter) HandleFunc(method, path string, h func(http.ResponseWriter, *http.Request)) { - f.Handle(method, path, http.HandlerFunc(h)) -} - -// SetNotFoundHandler will set httprouter.Router.NotFound. -func (f *FastRouter) SetNotFoundHandler(h http.Handler) { - f.mux.NotFound = h -} - -// ServeHTTP will call httprouter.ServerHTTP directly. -func (f *FastRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { - f.mux.ServeHTTP(w, r) -} - -// HTTPToFastRoute will convert an http.Handler to a httprouter.Handle -// by stuffing any route parameters into a Gorilla request context. -// To access the request parameters within the endpoint, -// use the `web.Vars` function. -func HTTPToFastRoute(fh http.Handler) httprouter.Handle { - return func(w http.ResponseWriter, r *http.Request, params httprouter.Params) { - if len(params) > 0 { - vars := map[string]string{} - for _, param := range params { - vars[param.Key] = param.Value - } - web.SetRouteVars(r, vars) - } - fh.ServeHTTP(w, r) - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/router_test.go b/vendor/github.com/NYTimes/gizmo/server/router_test.go deleted file mode 100644 index c4d40b26..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/router_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package server - -import ( - "net/http" - "net/http/httptest" - "testing" -) - -func TestFastRoute(t *testing.T) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkSimpleService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/1/{something}/blah", nil) - r.RemoteAddr = "0.0.0.0:8080" - - srvr.ServeHTTP(w, r) - - if w.Code != http.StatusOK { - t.Errorf("SimpleHealthCheck expected 200 response code, got %d", w.Code) - } - - wantBody := "blah" - if gotBody := w.Body.String(); gotBody != wantBody { - t.Errorf("Fast route expected response body to be %q, got %q", wantBody, gotBody) - } -} - -func TestGorillaRoute(t *testing.T) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkSimpleService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/1/blah/:something", nil) - r.RemoteAddr = "0.0.0.0:8080" - - srvr.ServeHTTP(w, r) - - if w.Code != http.StatusOK { - t.Errorf("SimpleHealthCheck expected 200 response code, got %d", w.Code) - } - - wantBody := "blah" - if gotBody := w.Body.String(); gotBody != wantBody { - t.Errorf("Fast route expected response body to be %q, got %q", wantBody, gotBody) - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/rpc_server.go b/vendor/github.com/NYTimes/gizmo/server/rpc_server.go deleted file mode 100644 index b6dca1a3..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/rpc_server.go +++ /dev/null @@ -1,321 +0,0 @@ -package server - -import ( - "errors" - "fmt" - "net" - "net/http" - "runtime/debug" - "strings" - "time" - - "github.com/NYTimes/logrotate" - "github.com/go-kit/kit/metrics" - "github.com/go-kit/kit/metrics/provider" - - "github.com/sirupsen/logrus" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" -) - -// RPCServer is an experimental server that serves a gRPC server on one -// port and the same endpoints via JSON on another port. -type RPCServer struct { - cfg *Config - - // exit chan for graceful shutdown - exit chan chan error - - // server for handling RPC requests - srvr *grpc.Server - - // mux for routing HTTP requests - mux Router - - // tracks active requests - monitor *ActivityMonitor - - mets provider.Provider - panicCounter metrics.Counter -} - -// NewRPCServer will instantiate a new experimental RPCServer with the given config. -func NewRPCServer(cfg *Config) *RPCServer { - if cfg == nil { - cfg = &Config{} - } - mx := NewRouter(cfg) - if cfg.NotFoundHandler != nil { - mx.SetNotFoundHandler(cfg.NotFoundHandler) - } - mets := newMetricsProvider(cfg) - return &RPCServer{ - cfg: cfg, - srvr: grpc.NewServer(), - mux: mx, - exit: make(chan chan error), - monitor: NewActivityMonitor(), - mets: mets, - panicCounter: mets.NewCounter("panic"), - } -} - -// Register will attempt to register the given RPCService with the server. -// If any other types are passed, Register will panic. -func (r *RPCServer) Register(svc Service) error { - rpcsvc, ok := svc.(RPCService) - if !ok { - Log.Fatalf("invalid service type for rpc server: %T", svc) - } - - // register RPC - desc, grpcSvc := rpcsvc.Service() - r.srvr.RegisterService(desc, grpcSvc) - // register endpoints - for _, mthd := range desc.Methods { - registerRPCMetrics(mthd.MethodName, r.mets) - } - - // register HTTP - // loop through json endpoints and register them - prefix := svc.Prefix() - // quick fix for backwards compatibility - prefix = strings.TrimRight(prefix, "/") - - // register all context endpoints with our wrapper - for path, epMethods := range rpcsvc.ContextEndpoints() { - for method, ep := range epMethods { - // set the function handle and register it to metrics - r.mux.Handle(method, prefix+path, TimedAndCounted( - func(ep ContextHandlerFunc, cs ContextService) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.Body != nil { - defer func() { - if err := r.Body.Close(); err != nil { - Log.Warn("unable to close request body: ", err) - } - }() - } - rpcsvc.Middleware(ContextToHTTP(rpcsvc.ContextMiddleware(ep))).ServeHTTP(w, r) - }) - }(ep, rpcsvc), - prefix+path, method, r.mets), - ) - } - } - - // register all JSON context endpoints with our wrapper - for path, epMethods := range rpcsvc.JSONEndpoints() { - for method, ep := range epMethods { - // set the function handle and register it to metrics - r.mux.Handle(method, prefix+path, TimedAndCounted( - rpcsvc.Middleware(ContextToHTTP(rpcsvc.ContextMiddleware( - JSONContextToHTTP(rpcsvc.JSONMiddleware(ep)), - ))), - prefix+path, method, r.mets), - ) - } - } - - RegisterProfiler(r.cfg, r.mux) - - return nil -} - -// Start start the RPC server. -func (r *RPCServer) Start() error { - // setup RPC - registerRPCAccessLogger(r.cfg) - rl, err := net.Listen("tcp", fmt.Sprintf(":%d", r.cfg.RPCPort)) - if err != nil { - return err - } - - go func() { - if err := r.srvr.Serve(rl); err != nil { - Log.Error("encountered an error while serving RPC listener: ", err) - } - }() - - Log.Infof("RPC listening on %s", rl.Addr().String()) - - // setup HTTP - healthHandler := RegisterHealthHandler(r.cfg, r.monitor, r.mux) - r.cfg.HealthCheckPath = healthHandler.Path() - - wrappedHandler, err := NewAccessLogMiddleware(r.cfg.RPCAccessLog, r) - if err != nil { - Log.Fatalf("unable to create http access log: %s", err) - } - - srv := httpServer(wrappedHandler) - var hl net.Listener - hl, err = net.Listen("tcp", fmt.Sprintf(":%d", r.cfg.HTTPPort)) - if err != nil { - return err - } - - go func() { - if err := srv.Serve(hl); err != nil { - Log.Error("encountered an error while serving listener: ", err) - } - }() - - Log.Infof("HTTP listening on %s", hl.Addr().String()) - - // join the LB - go func() { - exit := <-r.exit - - if err := healthHandler.Stop(); err != nil { - Log.Warn("health check Stop returned with error: ", err) - } - - r.srvr.Stop() - exit <- hl.Close() - }() - - return nil -} - -// Stop will signal the RPC server to stop and block until it does. -func (r *RPCServer) Stop() error { - ch := make(chan error) - r.exit <- ch - return <-ch -} - -// ServeHTTP is RPCServer's hook for metrics and safely executing each request. -func (r *RPCServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { - AddIPToContext(req) - - // only count non-LB requests - if req.URL.Path != r.cfg.HealthCheckPath { - r.monitor.CountRequest() - defer r.monitor.UncountRequest() - } - - r.safelyExecuteHTTPRequest(w, req) -} - -// executeRequestSafely will prevent a panic in a request from bringing the server down. -func (r *RPCServer) safelyExecuteHTTPRequest(w http.ResponseWriter, req *http.Request) { - defer func() { - if x := recover(); x != nil { - // register a panic'd request with our metrics - r.panicCounter.Add(1) - - // log the panic for all the details later - LogWithFields(req).Errorf("rpc server recovered from an HTTP panic\n%v: %v", x, string(debug.Stack())) - - // give the users our deepest regrets - w.WriteHeader(http.StatusInternalServerError) - if _, err := w.Write(UnexpectedServerError); err != nil { - LogWithFields(req).Warn("unable to write response: ", err) - } - - } - }() - - // hand the request off to gorilla - r.mux.ServeHTTP(w, req) -} - -// LogRPCWithFields will feed any request context into a logrus Entry. -func LogRPCWithFields(ctx context.Context, log *logrus.Logger) *logrus.Entry { - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - return logrus.NewEntry(log) - } - return log.WithFields(MetadataToFields(md)) -} - -// MetadataToFields will accept all values from a metadata.MD and -// create logrus.Fields with the same set. -func MetadataToFields(md metadata.MD) logrus.Fields { - f := logrus.Fields{} - for k, v := range md { - f[k] = v - } - return f -} - -// MonitorRPCRequest should be deferred by any RPC method that would like to have -// metrics and access logging, participate in graceful shutdowns and safely recover from panics. -func MonitorRPCRequest() func(ctx context.Context, methodName string, err *error) { - start := time.Now() - return func(ctx context.Context, methodName string, err *error) { - m := rpcEndpointMetrics["rpc."+methodName] - x := recover() - - if x != nil { - // log the panic for all the details later - Log.Warningf("rpc server recovered from a panic\n%v: %v", x, string(debug.Stack())) - - // give the users our deepest regrets - tmp := errors.New(string(UnexpectedServerError)) - err = &tmp - } - if m == nil { - Log.Errorf("unable to monitor rpc request. unknown method name: %s", methodName) - return - } - if x != nil { - // register a panic'd request with our metrics - m.PanicCounter.Add(1) - } - if *err == nil { - m.SuccessCounter.Add(1) - } else { - m.ErrorCounter.Add(1) - } - m.Timer.Observe(time.Since(start).Seconds()) - - if rpcAccessLog != nil { - LogRPCWithFields(ctx, rpcAccessLog).WithFields(logrus.Fields{ - "name": methodName, - "duration": time.Since(start), - "error": err, - }).Info("access") - } - } -} - -var rpcEndpointMetrics = map[string]*rpcMetrics{} - -type rpcMetrics struct { - Timer metrics.Histogram - SuccessCounter metrics.Counter - ErrorCounter metrics.Counter - PanicCounter metrics.Counter -} - -func registerRPCMetrics(name string, mets provider.Provider) { - name = "rpc." + name - rpcEndpointMetrics[name] = &rpcMetrics{ - Timer: mets.NewHistogram(name+".DURATION", 50), - SuccessCounter: mets.NewCounter(name + ".SUCCESS"), - ErrorCounter: mets.NewCounter(name + ".ERROR"), - PanicCounter: mets.NewCounter(name + ".PANIC"), - } -} - -// access logger -var rpcAccessLog *logrus.Logger - -func registerRPCAccessLogger(cfg *Config) { - // gRPC doesn't have a hook à la http.Handler-middleware - // so some of this duplicates logic from config.NewAccessLogMiddleware - if cfg.RPCAccessLog == nil { - return - } - - lf, err := logrotate.NewFile(*cfg.RPCAccessLog) - if err != nil { - Log.Fatalf("unable to access rpc access log file: %s", err) - } - - rpcAccessLog = logrus.New() - rpcAccessLog.Out = lf -} diff --git a/vendor/github.com/NYTimes/gizmo/server/server.go b/vendor/github.com/NYTimes/gizmo/server/server.go deleted file mode 100644 index e81a61ae..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/server.go +++ /dev/null @@ -1,289 +0,0 @@ -package server - -import ( - "errors" - "net/http" - "net/http/pprof" - "os" - "os/signal" - "runtime" - "strings" - "syscall" - "time" - - "github.com/sirupsen/logrus" - "github.com/go-kit/kit/metrics/provider" - "github.com/nu7hatch/gouuid" - - "github.com/NYTimes/gizmo/config/metrics" - "github.com/NYTimes/gizmo/web" - "github.com/NYTimes/logrotate" -) - -// Version is meant to be set with the current package version at build time. -var Version string - -// Server is the basic interface that defines what to expect from any server. -type Server interface { - Register(Service) error - Start() error - Stop() error -} - -var ( - // Name is used for status and logging. - Name = "nyt-awesome-go-server" - // Log is the global logger for the server. It will take care of logrotate - // and it can accept 'fields' to include with each log line: see LogWithFields(r). - Log = logrus.New() - // server is what's used in the global server funcs in the package. - server Server - // maxHeaderBytes is used by the http server to limit the size of request headers. - // This may need to be increased if accepting cookies from the public. - maxHeaderBytes = 1 << 20 - // readTimeout is used by the http server to set a maximum duration before - // timing out read of the request. The default timeout is 10 seconds. - readTimeout = 10 * time.Second - // writeTimeout is used by the http server to set a maximum duration before - // timing out write of the response. The default timeout is 10 seconds. - writeTimeout = 10 * time.Second - // jsonContentType is the content type that will be used for JSONEndpoints. - // It will default to the web.JSONContentType value. - jsonContentType = web.JSONContentType - // idleTimeout is used by the http server to set a maximum duration for - // keep-alive connections. - idleTimeout = 120 * time.Second -) - -// Init will set up our name, logging, healthchecks and parse flags. If DefaultServer isn't set, -// this func will set it to a `SimpleServer` listening on `Config.HTTPPort`. -func Init(name string, scfg *Config) { - // generate a unique ID for the server - id, _ := uuid.NewV4() - Name = name + "-" + Version + "-" + id.String() - - // if no config given, attempt to pull one from - // the environment. - if scfg == nil { - // allow the default config to be overridden by CLI - scfg = LoadConfigFromEnv() - SetConfigOverrides(scfg) - } - - if scfg.GOMAXPROCS != nil { - runtime.GOMAXPROCS(*scfg.GOMAXPROCS) - } else { - runtime.GOMAXPROCS(runtime.NumCPU()) - } - - if scfg.JSONContentType != nil { - jsonContentType = *scfg.JSONContentType - } - - if scfg.MaxHeaderBytes != nil { - maxHeaderBytes = *scfg.MaxHeaderBytes - } - - if scfg.ReadTimeout != nil { - tReadTimeout, err := time.ParseDuration(*scfg.ReadTimeout) - if err != nil { - Log.Fatal("invalid server ReadTimeout: ", err) - } - readTimeout = tReadTimeout - } - - if scfg.IdleTimeout != nil { - tIdleTimeout, err := time.ParseDuration(*scfg.IdleTimeout) - if err != nil { - Log.Fatal("invalid server IdleTimeout: ", err) - } - idleTimeout = tIdleTimeout - } - - if scfg.WriteTimeout != nil { - tWriteTimeout, err := time.ParseDuration(*scfg.WriteTimeout) - if err != nil { - Log.Fatal("invalid server WriteTimeout: ", err) - } - writeTimeout = tWriteTimeout - } - - // setup app logging - if scfg.Log != "" { - lf, err := logrotate.NewFile(scfg.Log) - if err != nil { - Log.Fatalf("unable to access log file: %s", err) - } - Log.Out = lf - - // json output when writing to file by default - if scfg.LogJSONFormat == nil { - Log.Formatter = &logrus.JSONFormatter{} - } - - } else { - Log.Out = os.Stderr - } - - // override default JSON settings - if scfg.LogJSONFormat != nil && *scfg.LogJSONFormat { - Log.Formatter = &logrus.JSONFormatter{} - } - - SetLogLevel(scfg) - - server = NewServer(scfg) -} - -// Register will add a new Service to the DefaultServer. -func Register(svc Service) error { - return server.Register(svc) -} - -// Run will start the DefaultServer and set it up to Stop() -// on a kill signal. -func Run() error { - Log.Infof("Starting new %s server", Name) - if err := server.Start(); err != nil { - return err - } - - // parse address for host, port - ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGTERM, syscall.SIGINT) - Log.Infof("Received signal %s", <-ch) - return Stop() -} - -// Stop will stop the default server. -func Stop() error { - Log.Infof("Stopping %s server", Name) - return server.Stop() -} - -// LogWithFields will feed any request context into a logrus Entry. -func LogWithFields(r *http.Request) *logrus.Entry { - return Log.WithFields(ContextFields(r)) -} - -// NewServer will inspect the config and generate -// the appropriate Server implementation. -func NewServer(cfg *Config) Server { - switch cfg.ServerType { - case "simple": - return NewSimpleServer(cfg) - case "rpc": - return NewRPCServer(cfg) - case "appengine": - cfg.appEngine = true - return NewSimpleServer(cfg) - default: - return NewSimpleServer(cfg) - } -} - -// NewHealthCheckHandler will inspect the config to generate -// the appropriate HealthCheckHandler. -func NewHealthCheckHandler(cfg *Config) (HealthCheckHandler, error) { - // default the status path if not set - if cfg.HealthCheckPath == "" { - cfg.HealthCheckPath = "/status.txt" - } - switch cfg.HealthCheckType { - case "simple": - return NewSimpleHealthCheck(cfg.HealthCheckPath), nil - case "esx": - return NewESXHealthCheck(), nil - case "custom": - if cfg.CustomHealthCheckHandler == nil { - return nil, errors.New("health check type is set to 'custom', but no Config.CustomHealthCheckHandler provided") - } - return NewCustomHealthCheck(cfg.HealthCheckPath, cfg.CustomHealthCheckHandler), nil - default: - return NewSimpleHealthCheck(cfg.HealthCheckPath), nil - } -} - -// RegisterProfiler will add handlers for pprof endpoints if -// the config has them enabled. -func RegisterProfiler(cfg *Config, mx Router) { - if !cfg.EnablePProf { - return - } - mx.HandleFunc("GET", "/debug/pprof/", pprof.Index) - mx.HandleFunc("GET", "/debug/pprof/cmdline", pprof.Cmdline) - mx.HandleFunc("GET", "/debug/pprof/profile", pprof.Profile) - mx.HandleFunc("GET", "/debug/pprof/symbol", pprof.Symbol) - mx.HandleFunc("GET", "/debug/pprof/trace", pprof.Trace) - - // Manually add support for paths linked to by index page at /debug/pprof/ - mx.Handle("GET", "/debug/pprof/goroutine", pprof.Handler("goroutine")) - mx.Handle("GET", "/debug/pprof/heap", pprof.Handler("heap")) - mx.Handle("GET", "/debug/pprof/threadcreate", pprof.Handler("threadcreate")) - mx.Handle("GET", "/debug/pprof/block", pprof.Handler("block")) -} - -// RegisterHealthHandler will create a new HealthCheckHandler from the -// given config and add a handler to the given router. -func RegisterHealthHandler(cfg *Config, monitor *ActivityMonitor, mx Router) HealthCheckHandler { - // register health check - hch, err := NewHealthCheckHandler(cfg) - if err != nil { - Log.Fatal("unable to configure the HealthCheckHandler: ", err) - } - err = hch.Start(monitor) - if err != nil { - Log.Fatal("unable to start the HealthCheckHandler: ", err) - } - mx.Handle("GET", hch.Path(), hch) - mx.Handle("HEAD", hch.Path(), hch) - return hch -} - -// MetricsNamespace returns "apps.{hostname prefix}", which is -// the convention used in NYT ESX environment. -func MetricsNamespace() string { - // get only server base name - name, _ := os.Hostname() - name = strings.SplitN(name, ".", 2)[0] - // set it up to be paperboy.servername - name = strings.Replace(name, "-", ".", 1) - // add the 'apps' prefix to keep things neat - return "apps." + name -} - -func newMetricsProvider(cfg *Config) provider.Provider { - if cfg.MetricsProvider != nil { - return cfg.MetricsProvider - } - // deal with deprecated GRAPHITE_HOST value - if cfg.GraphiteHost != nil { - cfg.Metrics.Type = metrics.Graphite - cfg.Metrics.Addr = *cfg.GraphiteHost - } - // set default metrics prefix - // to MetricsNamespace - if len(cfg.Metrics.Prefix) == 0 { - cfg.Metrics.Prefix = MetricsNamespace() + "." - } - // set default metrics namespace - // to MetricsNamespace - if len(cfg.Metrics.Prefix) == 0 { - cfg.Metrics.Namespace = MetricsNamespace() + "." - } - p := cfg.MetricsProvider - if p == nil { - p = cfg.Metrics.NewProvider() - } - return p -} - -// SetLogLevel will set the appropriate logrus log level -// given the server config. -func SetLogLevel(scfg *Config) { - if lvl, err := logrus.ParseLevel(scfg.LogLevel); err != nil { - Log.Level = logrus.InfoLevel - } else { - Log.Level = lvl - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/service.go b/vendor/github.com/NYTimes/gizmo/server/service.go deleted file mode 100644 index 2237e58a..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/service.go +++ /dev/null @@ -1,90 +0,0 @@ -package server - -import ( - "net/http" - - "google.golang.org/grpc" -) - -// Service is the most basic interface of a service that can be received and -// hosted by a Server. -type Service interface { - Prefix() string - - // Middleware is a hook to enable services to add - // any additional middleware. - Middleware(http.Handler) http.Handler -} - -// SimpleService is an interface defining a service that -// is made up of http.HandlerFuncs. -type SimpleService interface { - Service - - // route - method - func - Endpoints() map[string]map[string]http.HandlerFunc -} - -// JSONService is an interface defining a service that -// is made up of JSONEndpoints. -type JSONService interface { - Service - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - JSONMiddleware(JSONEndpoint) JSONEndpoint -} - -// MixedService is an interface defining service that -// offer JSONEndpoints and simple http.HandlerFunc endpoints. -type MixedService interface { - Service - - // route - method - func - Endpoints() map[string]map[string]http.HandlerFunc - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONEndpoint - JSONMiddleware(JSONEndpoint) JSONEndpoint -} - -// RPCService is an interface defining an grpc-compatible service that -// also offers JSONContextEndpoints and ContextHandlerFuncs. -type RPCService interface { - ContextService - - Service() (*grpc.ServiceDesc, interface{}) - - // Ensure that the route syntax is compatible with the router - // implementation chosen in cfg.RouterType. - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - JSONMiddleware(JSONContextEndpoint) JSONContextEndpoint -} - -// JSONEndpoint is the JSONService equivalent to SimpleService's http.HandlerFunc. -type JSONEndpoint func(*http.Request) (int, interface{}, error) - -// ContextService is an interface defining a service that -// is made up of ContextHandlerFuncs. -type ContextService interface { - Service - - // route - method - func - ContextEndpoints() map[string]map[string]ContextHandlerFunc - ContextMiddleware(ContextHandler) ContextHandler -} - -// MixedContextService is an interface defining a service that -// is made up of JSONContextEndpoints and ContextHandlerFuncs. -type MixedContextService interface { - ContextService - - // route - method - func - JSONEndpoints() map[string]map[string]JSONContextEndpoint - JSONContextMiddleware(JSONContextEndpoint) JSONContextEndpoint -} diff --git a/vendor/github.com/NYTimes/gizmo/server/service_go17.go b/vendor/github.com/NYTimes/gizmo/server/service_go17.go deleted file mode 100644 index b4e20692..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/service_go17.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build go1.7 - -package server - -import ( - "context" - "net/http" -) - -// JSONContextEndpoint is the JSONContextService equivalent to JSONService's JSONEndpoint. -type JSONContextEndpoint func(context.Context, *http.Request) (int, interface{}, error) - -// ContextHandlerFunc is an equivalent to SimpleService's http.HandlerFunc. -type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request) - -// ServeHTTPContext is an implementation of ContextHandler interface. -func (h ContextHandlerFunc) ServeHTTPContext(ctx context.Context, rw http.ResponseWriter, req *http.Request) { - h(ctx, rw, req) -} - -// ContextHandler is an equivalent to http.Handler but with additional param. -type ContextHandler interface { - ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) -} diff --git a/vendor/github.com/NYTimes/gizmo/server/service_pre_go17.go b/vendor/github.com/NYTimes/gizmo/server/service_pre_go17.go deleted file mode 100644 index 4f606ffc..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/service_pre_go17.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build !go1.7 - -package server - -import ( - "net/http" - - "golang.org/x/net/context" -) - -// JSONContextEndpoint is the JSONContextService equivalent to JSONService's JSONEndpoint. -type JSONContextEndpoint func(context.Context, *http.Request) (int, interface{}, error) - -// ContextHandlerFunc is an equivalent to SimpleService's http.HandlerFunc. -type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request) - -// ServeHTTPContext is an implementation of ContextHandler interface. -func (h ContextHandlerFunc) ServeHTTPContext(ctx context.Context, rw http.ResponseWriter, req *http.Request) { - h(ctx, rw, req) -} - -// ContextHandler is an equivalent to http.Handler but with additional param. -type ContextHandler interface { - ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) -} diff --git a/vendor/github.com/NYTimes/gizmo/server/simple_server.go b/vendor/github.com/NYTimes/gizmo/server/simple_server.go deleted file mode 100644 index 5145ca45..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/simple_server.go +++ /dev/null @@ -1,375 +0,0 @@ -package server - -import ( - "crypto/tls" - "errors" - "fmt" - "net" - "net/http" - "runtime/debug" - "strings" - - "github.com/go-kit/kit/metrics" - "github.com/go-kit/kit/metrics/provider" - "github.com/prometheus/client_golang/prometheus" - netContext "golang.org/x/net/context" - "google.golang.org/appengine" - - metricscfg "github.com/NYTimes/gizmo/config/metrics" - "github.com/NYTimes/gizmo/web" -) - -// SimpleServer is a basic http Server implementation for -// serving SimpleService, JSONService or MixedService implementations. -type SimpleServer struct { - cfg *Config - - // exit chan for graceful shutdown - exit chan chan error - - // mux for routing - mux Router - - // tracks active requests - monitor *ActivityMonitor - - // for collecting metrics - mets provider.Provider - panicCounter metrics.Counter -} - -// NewSimpleServer will init the mux, exit channel and -// build the address from the given port. It will register the HealthCheckHandler -// at the given path and set up the shutDownHandler to be called on Stop(). -func NewSimpleServer(cfg *Config) *SimpleServer { - if cfg == nil { - cfg = &Config{} - } - mx := NewRouter(cfg) - if cfg.NotFoundHandler != nil { - mx.SetNotFoundHandler(cfg.NotFoundHandler) - } - - mets := newMetricsProvider(cfg) - return &SimpleServer{ - mux: mx, - cfg: cfg, - exit: make(chan chan error), - monitor: NewActivityMonitor(), - mets: mets, - panicCounter: mets.NewCounter("panic"), - } -} - -// ServeHTTP is SimpleServer's hook for metrics and safely executing each request. -func (s *SimpleServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { - AddIPToContext(r) - - // only count non-LB requests - if r.URL.Path != s.cfg.HealthCheckPath { - s.monitor.CountRequest() - defer s.monitor.UncountRequest() - } - - s.safelyExecuteRequest(w, r) -} - -// UnexpectedServerError is returned with a 500 status code when SimpleServer recovers -// from a panic in a request. -var UnexpectedServerError = []byte("unexpected server error") - -// executeRequestSafely will prevent a panic in a request from bringing the server down. -func (s *SimpleServer) safelyExecuteRequest(w http.ResponseWriter, r *http.Request) { - - defer func() { - if x := recover(); x != nil { - // register a panic'd request with our metrics - s.panicCounter.Add(1) - - // log the panic for all the details later - LogWithFields(r).Errorf("simple server recovered from a panic\n%v: %v", x, string(debug.Stack())) - - // give the users our deepest regrets - w.WriteHeader(http.StatusInternalServerError) - if _, err := w.Write(UnexpectedServerError); err != nil { - LogWithFields(r).Warn("unable to write response: ", err) - } - } - }() - - // hand the request off to gorilla - s.mux.ServeHTTP(w, r) -} - -// Start will start the SimpleServer at it's configured address. -// If they are configured, this will start health checks and access logging. -func (s *SimpleServer) Start() error { - healthHandler := RegisterHealthHandler(s.cfg, s.monitor, s.mux) - s.cfg.HealthCheckPath = healthHandler.Path() - - // if expvar, register on our router - - switch s.cfg.Metrics.Type { - - case metricscfg.Expvar: - if s.cfg.Metrics.Path == "" { - s.cfg.Metrics.Path = "/debug/vars" - } - s.mux.HandleFunc("GET", s.cfg.Metrics.Path, expvarHandler) - - case metricscfg.Prometheus: - if s.cfg.Metrics.Path == "" { - s.cfg.Metrics.Path = "/metrics" - } - s.mux.HandleFunc("GET", s.cfg.Metrics.Path, - prometheus.InstrumentHandler("prometheus", prometheus.UninstrumentedHandler())) - } - - // if this is an App Engine setup, just run it here - if s.cfg.appEngine { - http.Handle("/", s) - appengine.Main() - return nil - } - - wrappedHandler, err := NewAccessLogMiddleware(s.cfg.HTTPAccessLog, s) - if err != nil { - Log.Fatalf("unable to create http access log: %s", err) - } - - srv := httpServer(wrappedHandler) - - l, err := net.Listen("tcp", fmt.Sprintf(":%d", s.cfg.HTTPPort)) - if err != nil { - return err - } - - l = net.Listener(TCPKeepAliveListener{l.(*net.TCPListener)}) - - // add TLS if in the configs - if s.cfg.TLSCertFile != nil && s.cfg.TLSKeyFile != nil { - cert, err := tls.LoadX509KeyPair(*s.cfg.TLSCertFile, *s.cfg.TLSKeyFile) - if err != nil { - return err - } - srv.TLSConfig = &tls.Config{ - Certificates: []tls.Certificate{cert}, - NextProtos: []string{"http/1.1"}, - } - - l = tls.NewListener(l, srv.TLSConfig) - } - - go func() { - if err := srv.Serve(l); err != nil { - Log.Error("encountered an error while serving listener: ", err) - } - }() - Log.Infof("Listening on %s", l.Addr().String()) - - // join the LB - go func() { - exit := <-s.exit - - // let the health check clean up if it needs to - if err := healthHandler.Stop(); err != nil { - Log.Warn("health check Stop returned with error: ", err) - } - - // flush any remaining metrics and close connections - s.mets.Stop() - - // stop the listener - exit <- l.Close() - }() - - return nil -} - -// Stop initiates the shutdown process and returns when -// the server completes. -func (s *SimpleServer) Stop() error { - ch := make(chan error) - s.exit <- ch - return <-ch -} - -// Register will accept and register SimpleServer, JSONService or MixedService implementations. -func (s *SimpleServer) Register(svcI Service) error { - prefix := svcI.Prefix() - // quick fix for backwards compatibility - prefix = strings.TrimRight(prefix, "/") - - var ( - js JSONService - ss SimpleService - cs ContextService - mcs MixedContextService - ) - - switch svc := svcI.(type) { - case MixedService: - js = svc - ss = svc - case SimpleService: - ss = svc - case JSONService: - js = svc - case MixedContextService: - mcs = svc - cs = svc - case ContextService: - cs = svc - default: - return errors.New("services for SimpleServers must implement the SimpleService, JSONService or MixedService interfaces") - } - - if ss != nil { - // register all simple endpoints with our wrapper - for path, epMethods := range ss.Endpoints() { - for method, ep := range epMethods { - // set the function handle and register it to metrics - s.mux.Handle(method, prefix+path, TimedAndCounted( - func(ep http.HandlerFunc, ss SimpleService) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // is it worth it to always close this? - if r.Body != nil { - defer func() { - if err := r.Body.Close(); err != nil { - Log.Warn("unable to close request body: ", err) - } - }() - } - - // call the func and return err or not - ss.Middleware(ep).ServeHTTP(w, r) - }) - }(ep, ss), - prefix+path, method, s.mets), - ) - } - } - } - - if js != nil { - // register all JSON endpoints with our wrapper - for path, epMethods := range js.JSONEndpoints() { - for method, ep := range epMethods { - // set the function handle and register it to metrics - s.mux.Handle(method, prefix+path, TimedAndCounted( - js.Middleware(JSONToHTTP(js.JSONMiddleware(ep))), - prefix+path, method, s.mets), - ) - } - } - } - - if cs != nil { - // register all context endpoints with our wrapper - for path, epMethods := range cs.ContextEndpoints() { - for method, ep := range epMethods { - // set the function handle and register it to metrics - s.mux.Handle(method, prefix+path, TimedAndCounted( - func(ep ContextHandlerFunc, cs ContextService) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // is it worth it to always close this? - if r.Body != nil { - defer func() { - if err := r.Body.Close(); err != nil { - Log.Warn("unable to close request body: ", err) - } - }() - } - // call the func and return err or not - cs.Middleware(ContextToHTTP(cs.ContextMiddleware(ep))).ServeHTTP(w, r) - }) - }(ep, cs), - prefix+path, method, s.mets), - ) - } - } - } - - if mcs != nil { - // register all context endpoints with our wrapper - for path, epMethods := range mcs.JSONEndpoints() { - for method, ep := range epMethods { - // set the function handle and register it to metrics - s.mux.Handle(method, prefix+path, TimedAndCounted( - mcs.Middleware(ContextToHTTP( - mcs.ContextMiddleware( - JSONContextToHTTP(mcs.JSONContextMiddleware(ep)), - ), - )), - prefix+path, method, s.mets), - ) - } - } - } - - RegisterProfiler(s.cfg, s.mux) - return nil -} - -// GetForwardedIP returns the "X-Forwarded-For" header value. -func GetForwardedIP(r *http.Request) string { - return r.Header.Get("X-Forwarded-For") -} - -// GetIP returns the IP address for the given request. -func GetIP(r *http.Request) (string, error) { - ip, ok := web.Vars(r)["ip"] - if ok { - return ip, nil - } - - // check real ip header first - ip = r.Header.Get("X-Real-IP") - if len(ip) > 0 { - return ip, nil - } - - // no nginx reverse proxy? - // get IP old fashioned way - ip, _, err := net.SplitHostPort(r.RemoteAddr) - if err != nil { - return "", fmt.Errorf("%q is not IP:port", r.RemoteAddr) - } - - userIP := net.ParseIP(ip) - if userIP == nil { - return "", fmt.Errorf("%q is not IP:port", r.RemoteAddr) - } - return userIP.String(), nil -} - -// ContextKey used to create context keys. -type ContextKey int - -const ( - // UserIPKey is key to set/retrieve value from context. - UserIPKey ContextKey = 0 - - // UserForwardForIPKey is key to set/retrieve value from context. - UserForwardForIPKey ContextKey = 1 -) - -// ContextWithUserIP returns new context with user ip address. -func ContextWithUserIP(ctx netContext.Context, r *http.Request) netContext.Context { - ip, err := GetIP(r) - if err != nil { - LogWithFields(r).Warningf("unable to get IP: %s", err) - return ctx - } - return netContext.WithValue(ctx, UserIPKey, ip) -} - -// ContextWithForwardForIP returns new context with forward for ip. -func ContextWithForwardForIP(ctx netContext.Context, r *http.Request) netContext.Context { - ip := GetForwardedIP(r) - if len(ip) > 0 { - ctx = netContext.WithValue(ctx, UserForwardForIPKey, ip) - } - - return ctx -} diff --git a/vendor/github.com/NYTimes/gizmo/server/simple_server_go17_test.go b/vendor/github.com/NYTimes/gizmo/server/simple_server_go17_test.go deleted file mode 100644 index be7fa9fc..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/simple_server_go17_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// +build go1.7 - -package server - -import ( - "context" - "fmt" - "net/http" - - "github.com/NYTimes/gizmo/web" -) - -type benchmarkContextService struct { - fast bool -} - -func (s *benchmarkContextService) Prefix() string { - return "/svc/v1" -} - -func (s *benchmarkContextService) ContextEndpoints() map[string]map[string]ContextHandlerFunc { - return map[string]map[string]ContextHandlerFunc{ - "/ctx/1/{something}/:something": map[string]ContextHandlerFunc{ - "GET": s.GetSimple, - }, - "/ctx/2": map[string]ContextHandlerFunc{ - "GET": s.GetSimpleNoParam, - }, - } -} - -func (s *benchmarkContextService) ContextMiddleware(h ContextHandler) ContextHandler { - return h -} - -func (s *benchmarkContextService) Middleware(h http.Handler) http.Handler { - return h -} - -func (s *benchmarkContextService) GetSimple(ctx context.Context, w http.ResponseWriter, r *http.Request) { - something := web.Vars(r)["something"] - fmt.Fprint(w, something) -} - -func (s *benchmarkContextService) GetSimpleNoParam(ctx context.Context, w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, "ok") -} diff --git a/vendor/github.com/NYTimes/gizmo/server/simple_server_pre_go17_test.go b/vendor/github.com/NYTimes/gizmo/server/simple_server_pre_go17_test.go deleted file mode 100644 index ee0400a5..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/simple_server_pre_go17_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// +build !go1.7 - -package server - -import ( - "fmt" - "net/http" - - "github.com/NYTimes/gizmo/web" - "golang.org/x/net/context" -) - -type benchmarkContextService struct { - fast bool -} - -func (s *benchmarkContextService) Prefix() string { - return "/svc/v1" -} - -func (s *benchmarkContextService) ContextEndpoints() map[string]map[string]ContextHandlerFunc { - return map[string]map[string]ContextHandlerFunc{ - "/ctx/1/{something}/:something": map[string]ContextHandlerFunc{ - "GET": s.GetSimple, - }, - "/ctx/2": map[string]ContextHandlerFunc{ - "GET": s.GetSimpleNoParam, - }, - } -} - -func (s *benchmarkContextService) ContextMiddleware(h ContextHandler) ContextHandler { - return h -} - -func (s *benchmarkContextService) Middleware(h http.Handler) http.Handler { - return h -} - -func (s *benchmarkContextService) GetSimple(ctx context.Context, w http.ResponseWriter, r *http.Request) { - something := web.Vars(r)["something"] - fmt.Fprint(w, something) -} - -func (s *benchmarkContextService) GetSimpleNoParam(ctx context.Context, w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, "ok") -} diff --git a/vendor/github.com/NYTimes/gizmo/server/simple_server_test.go b/vendor/github.com/NYTimes/gizmo/server/simple_server_test.go deleted file mode 100644 index e8ef1f8a..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/simple_server_test.go +++ /dev/null @@ -1,385 +0,0 @@ -package server - -import ( - "bytes" - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "testing" - - "github.com/NYTimes/gizmo/web" -) - -func BenchmarkFastSimpleServer_NoParam(b *testing.B) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkSimpleService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/2", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkFastSimpleServer_WithParam(b *testing.B) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkSimpleService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/1/{something}/blah", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkSimpleServer_NoParam(b *testing.B) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkSimpleService{}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/2", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkSimpleServer_WithParam(b *testing.B) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkSimpleService{}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/1/blah/:something", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -type benchmarkSimpleService struct { - fast bool -} - -func (s *benchmarkSimpleService) Prefix() string { - return "/svc/v1" -} - -func (s *benchmarkSimpleService) Endpoints() map[string]map[string]http.HandlerFunc { - return map[string]map[string]http.HandlerFunc{ - "/1/{something}/:something": map[string]http.HandlerFunc{ - "GET": s.GetSimple, - }, - "/2": map[string]http.HandlerFunc{ - "GET": s.GetSimpleNoParam, - }, - } -} - -func (s *benchmarkSimpleService) Middleware(h http.Handler) http.Handler { - return h -} - -func (s *benchmarkSimpleService) GetSimple(w http.ResponseWriter, r *http.Request) { - something := web.Vars(r)["something"] - fmt.Fprint(w, something) -} - -func (s *benchmarkSimpleService) GetSimpleNoParam(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, "ok") -} - -func BenchmarkFastJSONServer_JSONPayload(b *testing.B) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkJSONService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("PUT", "/svc/v1/1", bytes.NewBufferString(`{"hello":"hi","howdy":"yo"}`)) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} -func BenchmarkFastJSONServer_NoParam(b *testing.B) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkJSONService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("PUT", "/svc/v1/2", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} -func BenchmarkFastJSONServer_WithParam(b *testing.B) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkJSONService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("PUT", "/svc/v1/3/{something}/blah", bytes.NewBufferString(`{"hello":"hi","howdy":"yo"}`)) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkJSONServer_JSONPayload(b *testing.B) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkJSONService{}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("PUT", "/svc/v1/1", bytes.NewBufferString(`{"hello":"hi","howdy":"yo"}`)) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkJSONServer_NoParam(b *testing.B) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkJSONService{}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("PUT", "/svc/v1/2", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} -func BenchmarkJSONServer_WithParam(b *testing.B) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkJSONService{}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("PUT", "/svc/v1/3/blah/:something", bytes.NewBufferString(`{"hello":"hi","howdy":"yo"}`)) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -type benchmarkJSONService struct { - fast bool -} - -func (s *benchmarkJSONService) Prefix() string { - return "/svc/v1" -} - -func (s *benchmarkJSONService) JSONEndpoints() map[string]map[string]JSONEndpoint { - return map[string]map[string]JSONEndpoint{ - "/1": map[string]JSONEndpoint{ - "PUT": s.PutJSON, - }, - "/2": map[string]JSONEndpoint{ - "GET": s.GetJSON, - }, - "/3/{something}/:something": map[string]JSONEndpoint{ - "GET": s.GetJSONParam, - }, - } -} - -func (s *benchmarkJSONService) JSONMiddleware(e JSONEndpoint) JSONEndpoint { - return e -} - -func (s *benchmarkJSONService) Middleware(h http.Handler) http.Handler { - return h -} - -func (s *benchmarkJSONService) PutJSON(r *http.Request) (int, interface{}, error) { - var hello testJSON - err := json.NewDecoder(r.Body).Decode(&hello) - if err != nil { - return http.StatusBadRequest, nil, err - } - return http.StatusOK, hello, nil -} - -func (s *benchmarkJSONService) GetJSON(r *http.Request) (int, interface{}, error) { - return http.StatusOK, &testJSON{"hi", "howdy"}, nil -} - -func (s *benchmarkJSONService) GetJSONParam(r *http.Request) (int, interface{}, error) { - something := web.Vars(r)["something"] - return http.StatusOK, &testJSON{"hi", something}, nil -} - -func BenchmarkFastContextSimpleServer_NoParam(b *testing.B) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkContextService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/ctx/2", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkFastContextSimpleServer_WithParam(b *testing.B) { - cfg := &Config{RouterType: "fast", HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkContextService{true}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/ctx/1/{something}/blah", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkContextSimpleServer_NoParam(b *testing.B) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkContextService{}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/ctx/2", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -func BenchmarkContextSimpleServer_WithParam(b *testing.B) { - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - srvr := NewSimpleServer(cfg) - RegisterHealthHandler(cfg, srvr.monitor, srvr.mux) - srvr.Register(&benchmarkContextService{}) - - w := httptest.NewRecorder() - r, _ := http.NewRequest("GET", "/svc/v1/ctx/1/blah/:something", nil) - r.RemoteAddr = "0.0.0.0:8080" - - for i := 0; i < b.N; i++ { - srvr.ServeHTTP(w, r) - } -} - -type testJSON struct { - Hello string `json:"hello"` - Howdy string `json:"howdy"` -} - -type testMixedService struct { - fast bool -} - -func (s *testMixedService) Prefix() string { - return "/svc/v1" -} - -func (s *testMixedService) JSONEndpoints() map[string]map[string]JSONEndpoint { - return map[string]map[string]JSONEndpoint{ - "/json": map[string]JSONEndpoint{ - "GET": s.GetJSON, - }, - } -} - -func (s *testMixedService) Endpoints() map[string]map[string]http.HandlerFunc { - return map[string]map[string]http.HandlerFunc{ - "/simple": map[string]http.HandlerFunc{ - "GET": s.GetSimple, - }, - } -} - -func (s *testMixedService) GetSimple(w http.ResponseWriter, r *http.Request) { - something := web.Vars(r)["something"] - fmt.Fprint(w, something) -} - -func (s *testMixedService) GetJSON(r *http.Request) (int, interface{}, error) { - return http.StatusOK, &testJSON{"hi", "howdy"}, nil -} - -func (s *testMixedService) JSONMiddleware(e JSONEndpoint) JSONEndpoint { - return e -} - -func (s *testMixedService) Middleware(h http.Handler) http.Handler { - return h -} - -type testInvalidService struct { - fast bool -} - -func (s *testInvalidService) Prefix() string { - return "/svc/v1" -} - -func (s *testInvalidService) Middleware(h http.Handler) http.Handler { - return h -} - -func TestFactory(*testing.T) { - // with config: - cfg := &Config{HealthCheckType: "simple", HealthCheckPath: "/status"} - NewSimpleServer(cfg) - - // without config: - NewSimpleServer(nil) -} - -func TestBasicRegistration(t *testing.T) { - s := NewSimpleServer(nil) - services := []Service{ - &benchmarkSimpleService{}, - &benchmarkJSONService{}, - &testMixedService{}, - &benchmarkContextService{}, - } - for _, svc := range services { - if err := s.Register(svc); err != nil { - t.Errorf("Basic registration of services should not encounter an error: %s\n", err) - } - } - - if err := s.Register(&testInvalidService{}); err == nil { - t.Error("Invalid services should produce an error in service registration") - } -} diff --git a/vendor/github.com/NYTimes/gizmo/server/tcp.go b/vendor/github.com/NYTimes/gizmo/server/tcp.go deleted file mode 100644 index 692264de..00000000 --- a/vendor/github.com/NYTimes/gizmo/server/tcp.go +++ /dev/null @@ -1,38 +0,0 @@ -package server - -import ( - "net" - "time" -) - -// TCPKeepAliveListener sets TCP keep-alive timeouts on accepted -// connections. It's used by ListenAndServe and ListenAndServeTLS so -// dead TCP connections (e.g. closing laptop mid-download) eventually -// go away. -// -// This is here because it is not exposed in the stdlib and -// we'd prefer to have a hold of the http.Server's net.Listener so we can close it -// on shutdown. -// -// Taken from here: https://golang.org/src/net/http/server.go?s=63121:63175#L2120 -type TCPKeepAliveListener struct { - *net.TCPListener -} - -// Accept accepts the next incoming call and returns the new -// connection. KeepAlivePeriod is set properly. -func (ln TCPKeepAliveListener) Accept() (c net.Conn, err error) { - tc, err := ln.AcceptTCP() - if err != nil { - return - } - err = tc.SetKeepAlive(true) - if err != nil { - return - } - err = tc.SetKeepAlivePeriod(3 * time.Minute) - if err != nil { - return - } - return tc, nil -} diff --git a/vendor/github.com/NYTimes/gizmo/web/doc.go b/vendor/github.com/NYTimes/gizmo/web/doc.go deleted file mode 100644 index dff106d6..00000000 --- a/vendor/github.com/NYTimes/gizmo/web/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -/* -Package web contains a handful of very useful functions for parsing types from request queries and payloads. -*/ -package web diff --git a/vendor/github.com/NYTimes/gizmo/web/func.go b/vendor/github.com/NYTimes/gizmo/web/func.go deleted file mode 100644 index d2083ba1..00000000 --- a/vendor/github.com/NYTimes/gizmo/web/func.go +++ /dev/null @@ -1,103 +0,0 @@ -package web - -import ( - "errors" - "fmt" - "net/http" - "strconv" - "time" -) - -// Let's have generic errors for expected conditions. Typically -// these would be http.StatusBadRequest (400) -var ( - JSONContentType = "application/json; charset=UTF-8" - DateISOFormat = "2006-01-02" -) - -// ParseISODate is a handy function to accept -func ParseISODate(dateStr string) (date time.Time, err error) { - date, err = time.ParseInLocation(DateISOFormat, dateStr, time.Local) - return -} - -// ParseDateRange will look for and parse 'startDate' and 'endDate' ISO date -// strings in the given vars map. -func ParseDateRange(vars map[string]string) (startDate time.Time, endDate time.Time, err error) { - startDate, err = ParseISODate(vars["startDate"]) - if err != nil { - err = errors.New("please use a valid start date with a format of YYYY-MM-DD") - return - } - - endDate, err = ParseISODate(vars["endDate"]) - if err != nil { - err = errors.New("please use a valid end date with a format of YYYY-MM-DD") - return - } - - return -} - -// GetInt64Var is a helper to pull gorilla mux Vars. -// If the value is empty, it falls back to the URL -// query string. -// We are ignoring the error here bc we're assuming -// the path had a [0-9]+ descriptor on this var. -func GetInt64Var(r *http.Request, key string) int64 { - v := Vars(r)[key] - if len(v) == 0 { - va := r.URL.Query()[key] - if len(va) > 0 { - v = va[0] - } - } - i, _ := strconv.ParseInt(v, 10, 64) - - return i -} - -// GetUInt64Var is a helper to pull gorilla mux Vars. -// If the value is empty, it falls back to the URL -// query string. -// We are ignoring the error here bc we're assuming -// the path had a [0-9]+ descriptor on this var. -func GetUInt64Var(r *http.Request, key string) uint64 { - v := Vars(r)[key] - if len(v) == 0 { - va := r.URL.Query()[key] - if len(va) > 0 { - v = va[0] - } - } - i, _ := strconv.ParseUint(v, 10, 64) - return i -} - -// ParseDateRangeFullDay will look for and parse 'startDate' and 'endDate' ISO -// date strings in the given vars map. It will then set the startDate time to -// midnight and the endDate time to 23:59:59. -func ParseDateRangeFullDay(vars map[string]string) (startDate time.Time, endDate time.Time, err error) { - startDate, endDate, err = ParseDateRange(vars) - if err != nil { - return - } - - // set time to beginning of day - startDate = time.Date(startDate.Year(), startDate.Month(), startDate.Day(), 0, 0, - 0, 0, time.Local) - // set the time to the end of day - endDate = time.Date(endDate.Year(), endDate.Month(), endDate.Day(), 23, 59, - 59, 1000, time.Local) - return -} - -// ParseTruthyFalsy is a helper method to attempt to parse booleans in -// APIs that have no set contract on what a boolean should look like. -func ParseTruthyFalsy(flag interface{}) (result bool, err error) { - s := fmt.Sprint(flag) - if s == "" { - return false, nil - } - return strconv.ParseBool(s) -} diff --git a/vendor/github.com/NYTimes/gizmo/web/func_test.go b/vendor/github.com/NYTimes/gizmo/web/func_test.go deleted file mode 100644 index d943d99d..00000000 --- a/vendor/github.com/NYTimes/gizmo/web/func_test.go +++ /dev/null @@ -1,403 +0,0 @@ -package web_test - -import ( - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/NYTimes/gizmo/web" - "github.com/gorilla/mux" -) - -func TestParseISODate(t *testing.T) { - tests := []struct { - given string - - want time.Time - wantErr bool - }{ - { - "2015-10-29", - - time.Date(2015, time.October, 29, 0, 0, 0, 0, time.Local), - false, - }, - { - "20151029", - - time.Time{}, - true, - }, - } - - for _, test := range tests { - got, gotErr := web.ParseISODate(test.given) - - if test.wantErr { - if gotErr == nil { - t.Error("expected an error and did not get one") - } - continue - } - - if gotErr != nil { - t.Error("did not expect an error but got one: ", gotErr) - } - - if !got.Equal(test.want) { - t.Errorf("got %#v, expected %#v: ", got, test.want) - } - - } -} - -func TestParseDateRangeFullDay(t *testing.T) { - tests := []struct { - given map[string]string - - wantStart time.Time - wantEnd time.Time - wantErr bool - }{ - { - map[string]string{ - "startDate": "2015-10-29", - "endDate": "2015-10-31", - }, - - time.Date(2015, time.October, 29, 0, 0, 0, 0, time.Local), - time.Date(2015, time.October, 31, 23, 59, 59, 1000, time.Local), - false, - }, - { - map[string]string{ - "startDate": "2015-10-29", - "endDate": "-10-31", - }, - - time.Time{}, - time.Time{}, - true, - }, - { - map[string]string{ - "startDate": "-10-29", - "endDate": "2015-10-31", - }, - - time.Time{}, - time.Time{}, - true, - }, - { - map[string]string{ - "endDate": "2015-10-31", - }, - - time.Time{}, - time.Time{}, - true, - }, - { - map[string]string{ - "startDate": "-10-29", - }, - - time.Time{}, - time.Time{}, - true, - }, - } - - for _, test := range tests { - gotStart, gotEnd, gotErr := web.ParseDateRangeFullDay(test.given) - - if test.wantErr { - if gotErr == nil { - t.Error("expected an error and did not get one") - } - continue - } - - if gotErr != nil { - t.Error("did not expect an error but got one: ", gotErr) - } - - if !gotStart.Equal(test.wantStart) { - t.Errorf("got start date of %#v, expected %#v: ", gotStart, test.wantStart) - } - - if !gotEnd.Equal(test.wantEnd) { - t.Errorf("got end date of %#v, expected %#v: ", gotStart, test.wantStart) - } - } -} - -func TestParseDateRange(t *testing.T) { - tests := []struct { - given map[string]string - - wantStart time.Time - wantEnd time.Time - wantErr bool - }{ - { - map[string]string{ - "startDate": "2015-10-29", - "endDate": "2015-10-31", - }, - - time.Date(2015, time.October, 29, 0, 0, 0, 0, time.Local), - time.Date(2015, time.October, 31, 0, 0, 0, 0, time.Local), - false, - }, - { - map[string]string{ - "startDate": "2015-10-29", - "endDate": "-10-31", - }, - - time.Time{}, - time.Time{}, - true, - }, - { - map[string]string{ - "startDate": "-10-29", - "endDate": "2015-10-31", - }, - - time.Time{}, - time.Time{}, - true, - }, - { - map[string]string{ - "endDate": "2015-10-31", - }, - - time.Time{}, - time.Time{}, - true, - }, - { - map[string]string{ - "startDate": "-10-29", - }, - - time.Time{}, - time.Time{}, - true, - }, - } - - for _, test := range tests { - gotStart, gotEnd, gotErr := web.ParseDateRange(test.given) - - if test.wantErr { - if gotErr == nil { - t.Error("expected an error and did not get one") - } - continue - } - - if gotErr != nil { - t.Error("did not expect an error but got one: ", gotErr) - } - - if !gotStart.Equal(test.wantStart) { - t.Errorf("got start date of %#v, expected %#v: ", gotStart, test.wantStart) - } - - if !gotEnd.Equal(test.wantEnd) { - t.Errorf("got end date of %#v, expected %#v: ", gotStart, test.wantStart) - } - } -} - -func TestGetUInt64Var(t *testing.T) { - - tests := []struct { - givenURL string - givenRoute string - - want uint64 - }{ - { - "/blah/123", - "/blah/{key}", - 123, - }, - { - "/blah/adsf", - "/blah/{key}", - 0, - }, - { - "/blah?key=123", - "/blah", - 123, - }, - { - "/blah?key=abc", - "/blah", - 0, - }, - } - - for _, test := range tests { - route := mux.NewRouter() - route.HandleFunc(test.givenRoute, func(w http.ResponseWriter, r *http.Request) { - web.SetRouteVars(r, mux.Vars(r)) - got := web.GetUInt64Var(r, "key") - if got != test.want { - t.Errorf("URL(%s): got int of %#v, expected %#v", test.givenURL, got, test.want) - } - }) - - r, _ := http.NewRequest("GET", test.givenURL, nil) - route.ServeHTTP(httptest.NewRecorder(), r) - } -} - -func TestGetInt64Var(t *testing.T) { - - tests := []struct { - givenURL string - givenRoute string - - want int64 - }{ - { - "/blah/123", - "/blah/{key}", - 123, - }, - { - "/blah/adsf", - "/blah/{key}", - 0, - }, - { - "/blah?key=123", - "/blah", - 123, - }, - { - "/blah?key=abc", - "/blah", - 0, - }, - } - - for _, test := range tests { - route := mux.NewRouter() - route.HandleFunc(test.givenRoute, func(w http.ResponseWriter, r *http.Request) { - web.SetRouteVars(r, mux.Vars(r)) - got := web.GetInt64Var(r, "key") - if got != test.want { - t.Errorf("URL(%s): got int of %#v, expected %#v", test.givenURL, got, test.want) - } - }) - - r, _ := http.NewRequest("GET", test.givenURL, nil) - route.ServeHTTP(httptest.NewRecorder(), r) - } -} - -func TestParseTruthyFalsy(t *testing.T) { - tests := []struct { - given interface{} - - want bool - wantErr bool - }{ - { - "true", - true, - false, - }, - { - "false", - false, - false, - }, - { - "0", - false, - false, - }, - { - "1", - true, - false, - }, - { - "", - false, - false, - }, - { - "nope!", - false, - true, - }, - { - 1, - true, - false, - }, - { - 0, - false, - false, - }, - { - 2, - false, - true, - }, - { - float64(0.0), - false, - false, - }, - { - float64(1.0), - true, - false, - }, - { - float64(2.0), - false, - true, - }, - { - true, - true, - false, - }, - { - false, - false, - false, - }, - } - - for _, test := range tests { - - got, gotErr := web.ParseTruthyFalsy(test.given) - - if test.wantErr != (gotErr != nil) { - t.Errorf("wantErr is %v, but got %s", test.wantErr, gotErr) - } - - if test.want != got { - t.Errorf("expected %v, got %v", test.want, got) - - } - - } - -} diff --git a/vendor/github.com/NYTimes/gizmo/web/vars_gorilla.go b/vendor/github.com/NYTimes/gizmo/web/vars_gorilla.go deleted file mode 100644 index 46a2a5cd..00000000 --- a/vendor/github.com/NYTimes/gizmo/web/vars_gorilla.go +++ /dev/null @@ -1,34 +0,0 @@ -// +build !go1.7 - -package web - -import ( - "net/http" - - "github.com/gorilla/context" -) - -// Vars is a helper function for accessing route -// parameters from any server.Router implementation. This is the equivalent -// of using `mux.Vars(r)` with the Gorilla mux.Router. -func Vars(r *http.Request) map[string]string { - if rv := context.Get(r, varsKey); rv != nil { - vars, _ := rv.(map[string]string) - return vars - } - return nil -} - -// SetRouteVars will set the given value into into the request context -// with the shared 'vars' storage key. -func SetRouteVars(r *http.Request, val interface{}) { - if val != nil { - context.Set(r, varsKey, val) - } -} - -type contextKey int - -// key to set/retrieve URL params from a -// Gorilla request context. -const varsKey contextKey = 2 diff --git a/vendor/github.com/NYTimes/gizmo/web/vars_native.go b/vendor/github.com/NYTimes/gizmo/web/vars_native.go deleted file mode 100644 index f93d031e..00000000 --- a/vendor/github.com/NYTimes/gizmo/web/vars_native.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build go1.7 - -package web - -import ( - "context" - "net/http" -) - -// Vars is a helper function for accessing route -// parameters from any server.Router implementation. This is the equivalent -// of using `mux.Vars(r)` with the Gorilla mux.Router. -func Vars(r *http.Request) map[string]string { - // vars doesnt exist yet, return empty map - rawVars := r.Context().Value(varsKey) - if rawVars == nil { - return map[string]string{} - } - - // for some reason, vars is wrong type, return empty map - vars, _ := rawVars.(map[string]string) - return vars -} - -// SetRouteVars will set the given value into into the request context -// with the shared 'vars' storage key. -func SetRouteVars(r *http.Request, val interface{}) { - if val == nil { - return - } - - r2 := r.WithContext(context.WithValue(r.Context(), varsKey, val)) - *r = *r2 -} - -type contextKey int - -// key to set/retrieve URL params from a -// Gorilla request context. -const varsKey contextKey = 2 diff --git a/vendor/github.com/NYTimes/gziphandler/.gitignore b/vendor/github.com/NYTimes/gziphandler/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/NYTimes/gziphandler/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/NYTimes/gziphandler/.travis.yml b/vendor/github.com/NYTimes/gziphandler/.travis.yml deleted file mode 100644 index d2b67f69..00000000 --- a/vendor/github.com/NYTimes/gziphandler/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: go - -go: - - 1.7 - - 1.8 - - tip diff --git a/vendor/github.com/NYTimes/gziphandler/CODE_OF_CONDUCT.md b/vendor/github.com/NYTimes/gziphandler/CODE_OF_CONDUCT.md deleted file mode 100644 index cdbca194..00000000 --- a/vendor/github.com/NYTimes/gziphandler/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -layout: code-of-conduct -version: v1.0 ---- - -This code of conduct outlines our expectations for participants within the **NYTimes/gziphandler** community, as well as steps to reporting unacceptable behavior. We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored. Anyone who violates this code of conduct may be banned from the community. - -Our open source community strives to: - -* **Be friendly and patient.** -* **Be welcoming**: We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability. -* **Be considerate**: Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language. -* **Be respectful**: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. -* **Be careful in the words that we choose**: we are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. -* **Try to understand why we disagree**: Disagreements, both social and technical, happen all the time. It is important that we resolve disagreements and differing views constructively. Remember that we’re different. The strength of our community comes from its diversity, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes. - -## Definitions - -Harassment includes, but is not limited to: - -- Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, neuro(a)typicality, physical appearance, body size, race, age, regional discrimination, political or religious affiliation -- Unwelcome comments regarding a person’s lifestyle choices and practices, including those related to food, health, parenting, drugs, and employment -- Deliberate misgendering. This includes deadnaming or persistently using a pronoun that does not correctly reflect a person's gender identity. You must address people by the name they give you when not addressing them by their username or handle -- Physical contact and simulated physical contact (eg, textual descriptions like “*hug*” or “*backrub*”) without consent or after a request to stop -- Threats of violence, both physical and psychological -- Incitement of violence towards any individual, including encouraging a person to commit suicide or to engage in self-harm -- Deliberate intimidation -- Stalking or following -- Harassing photography or recording, including logging online activity for harassment purposes -- Sustained disruption of discussion -- Unwelcome sexual attention, including gratuitous or off-topic sexual images or behaviour -- Pattern of inappropriate social contact, such as requesting/assuming inappropriate levels of intimacy with others -- Continued one-on-one communication after requests to cease -- Deliberate “outing” of any aspect of a person’s identity without their consent except as necessary to protect others from intentional abuse -- Publication of non-harassing private communication - -Our open source community prioritizes marginalized people’s safety over privileged people’s comfort. We will not act on complaints regarding: - -- ‘Reverse’ -isms, including ‘reverse racism,’ ‘reverse sexism,’ and ‘cisphobia’ -- Reasonable communication of boundaries, such as “leave me alone,” “go away,” or “I’m not discussing this with you” -- Refusal to explain or debate social justice concepts -- Communicating in a ‘tone’ you don’t find congenial -- Criticizing racist, sexist, cissexist, or otherwise oppressive behavior or assumptions - - -### Diversity Statement - -We encourage everyone to participate and are committed to building a community for all. Although we will fail at times, we seek to treat everyone both as fairly and equally as possible. Whenever a participant has made a mistake, we expect them to take responsibility for it. If someone has been harmed or offended, it is our responsibility to listen carefully and respectfully, and do our best to right the wrong. - -Although this list cannot be exhaustive, we explicitly honor diversity in age, gender, gender identity or expression, culture, ethnicity, language, national origin, political beliefs, profession, race, religion, sexual orientation, socioeconomic status, and technical ability. We will not tolerate discrimination based on any of the protected -characteristics above, including participants with disabilities. - -### Reporting Issues - -If you experience or witness unacceptable behavior—or have any other concerns—please report it by contacting us via **code@nytimes.com**. All reports will be handled with discretion. In your report please include: - -- Your contact information. -- Names (real, nicknames, or pseudonyms) of any individuals involved. If there are additional witnesses, please -include them as well. Your account of what occurred, and if you believe the incident is ongoing. If there is a publicly available record (e.g. a mailing list archive or a public IRC logger), please include a link. -- Any additional information that may be helpful. - -After filing a report, a representative will contact you personally, review the incident, follow up with any additional questions, and make a decision as to how to respond. If the person who is harassing you is part of the response team, they will recuse themselves from handling your incident. If the complaint originates from a member of the response team, it will be handled by a different member of the response team. We will respect confidentiality requests for the purpose of protecting victims of abuse. - -### Attribution & Acknowledgements - -We all stand on the shoulders of giants across many open source communities. We'd like to thank the communities and projects that established code of conducts and diversity statements as our inspiration: - -* [Django](https://www.djangoproject.com/conduct/reporting/) -* [Python](https://www.python.org/community/diversity/) -* [Ubuntu](http://www.ubuntu.com/about/about-ubuntu/conduct) -* [Contributor Covenant](http://contributor-covenant.org/) -* [Geek Feminism](http://geekfeminism.org/about/code-of-conduct/) -* [Citizen Code of Conduct](http://citizencodeofconduct.org/) - -This Code of Conduct was based on https://github.com/todogroup/opencodeofconduct diff --git a/vendor/github.com/NYTimes/gziphandler/CONTRIBUTING.md b/vendor/github.com/NYTimes/gziphandler/CONTRIBUTING.md deleted file mode 100644 index b89a9eb4..00000000 --- a/vendor/github.com/NYTimes/gziphandler/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -# Contributing to NYTimes/gziphandler - -This is an open source project started by handful of developers at The New York Times and open to the entire Go community. - -We really appreciate your help! - -## Filing issues - -When filing an issue, make sure to answer these five questions: - -1. What version of Go are you using (`go version`)? -2. What operating system and processor architecture are you using? -3. What did you do? -4. What did you expect to see? -5. What did you see instead? - -## Contributing code - -Before submitting changes, please follow these guidelines: - -1. Check the open issues and pull requests for existing discussions. -2. Open an issue to discuss a new feature. -3. Write tests. -4. Make sure code follows the ['Go Code Review Comments'](https://github.com/golang/go/wiki/CodeReviewComments). -5. Make sure your changes pass `go test`. -6. Make sure the entire test suite passes locally and on Travis CI. -7. Open a Pull Request. -8. [Squash your commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) after receiving feedback and add a [great commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). - -Unless otherwise noted, the gziphandler source files are distributed under the Apache 2.0-style license found in the LICENSE.md file. diff --git a/vendor/github.com/NYTimes/gziphandler/LICENSE b/vendor/github.com/NYTimes/gziphandler/LICENSE deleted file mode 100644 index df6192d3..00000000 --- a/vendor/github.com/NYTimes/gziphandler/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016-2017 The New York Times Company - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/NYTimes/gziphandler/README.md b/vendor/github.com/NYTimes/gziphandler/README.md deleted file mode 100644 index 6d724607..00000000 --- a/vendor/github.com/NYTimes/gziphandler/README.md +++ /dev/null @@ -1,52 +0,0 @@ -Gzip Handler -============ - -This is a tiny Go package which wraps HTTP handlers to transparently gzip the -response body, for clients which support it. Although it's usually simpler to -leave that to a reverse proxy (like nginx or Varnish), this package is useful -when that's undesirable. - - -## Usage - -Call `GzipHandler` with any handler (an object which implements the -`http.Handler` interface), and it'll return a new handler which gzips the -response. For example: - -```go -package main - -import ( - "io" - "net/http" - "github.com/NYTimes/gziphandler" -) - -func main() { - withoutGz := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "text/plain") - io.WriteString(w, "Hello, World") - }) - - withGz := gziphandler.GzipHandler(withoutGz) - - http.Handle("/", withGz) - http.ListenAndServe("0.0.0.0:8000", nil) -} -``` - - -## Documentation - -The docs can be found at [godoc.org][docs], as usual. - - -## License - -[Apache 2.0][license]. - - - - -[docs]: https://godoc.org/github.com/nytimes/gziphandler -[license]: https://github.com/nytimes/gziphandler/blob/master/LICENSE.md diff --git a/vendor/github.com/NYTimes/gziphandler/gzip.go b/vendor/github.com/NYTimes/gziphandler/gzip.go deleted file mode 100644 index b6af9115..00000000 --- a/vendor/github.com/NYTimes/gziphandler/gzip.go +++ /dev/null @@ -1,407 +0,0 @@ -package gziphandler - -import ( - "bufio" - "compress/gzip" - "fmt" - "io" - "net" - "net/http" - "strconv" - "strings" - "sync" -) - -const ( - vary = "Vary" - acceptEncoding = "Accept-Encoding" - contentEncoding = "Content-Encoding" - contentType = "Content-Type" - contentLength = "Content-Length" -) - -type codings map[string]float64 - -const ( - // DefaultQValue is the default qvalue to assign to an encoding if no explicit qvalue is set. - // This is actually kind of ambiguous in RFC 2616, so hopefully it's correct. - // The examples seem to indicate that it is. - DefaultQValue = 1.0 - - // DefaultMinSize defines the minimum size to reach to enable compression. - // It's 512 bytes. - DefaultMinSize = 512 -) - -// gzipWriterPools stores a sync.Pool for each compression level for reuse of -// gzip.Writers. Use poolIndex to covert a compression level to an index into -// gzipWriterPools. -var gzipWriterPools [gzip.BestCompression - gzip.BestSpeed + 2]*sync.Pool - -func init() { - for i := gzip.BestSpeed; i <= gzip.BestCompression; i++ { - addLevelPool(i) - } - addLevelPool(gzip.DefaultCompression) -} - -// poolIndex maps a compression level to its index into gzipWriterPools. It -// assumes that level is a valid gzip compression level. -func poolIndex(level int) int { - // gzip.DefaultCompression == -1, so we need to treat it special. - if level == gzip.DefaultCompression { - return gzip.BestCompression - gzip.BestSpeed + 1 - } - return level - gzip.BestSpeed -} - -func addLevelPool(level int) { - gzipWriterPools[poolIndex(level)] = &sync.Pool{ - New: func() interface{} { - // NewWriterLevel only returns error on a bad level, we are guaranteeing - // that this will be a valid level so it is okay to ignore the returned - // error. - w, _ := gzip.NewWriterLevel(nil, level) - return w - }, - } -} - -// GzipResponseWriter provides an http.ResponseWriter interface, which gzips -// bytes before writing them to the underlying response. This doesn't close the -// writers, so don't forget to do that. -// It can be configured to skip response smaller than minSize. -type GzipResponseWriter struct { - http.ResponseWriter - index int // Index for gzipWriterPools. - gw *gzip.Writer - - code int // Saves the WriteHeader value. - - minSize int // Specifed the minimum response size to gzip. If the response length is bigger than this value, it is compressed. - buf []byte // Holds the first part of the write before reaching the minSize or the end of the write. - - contentTypes []string // Only compress if the response is one of these content-types. All are accepted if empty. -} - -// Write appends data to the gzip writer. -func (w *GzipResponseWriter) Write(b []byte) (int, error) { - // If content type is not set. - if _, ok := w.Header()[contentType]; !ok { - // It infer it from the uncompressed body. - w.Header().Set(contentType, http.DetectContentType(b)) - } - - // GZIP responseWriter is initialized. Use the GZIP responseWriter. - if w.gw != nil { - n, err := w.gw.Write(b) - return n, err - } - - // Save the write into a buffer for later use in GZIP responseWriter (if content is long enough) or at close with regular responseWriter. - // On the first write, w.buf changes from nil to a valid slice - w.buf = append(w.buf, b...) - - // If the global writes are bigger than the minSize and we're about to write - // a response containing a content type we want to handle, enable - // compression. - if len(w.buf) >= w.minSize && handleContentType(w.contentTypes, w) && w.Header().Get(contentEncoding) == "" { - err := w.startGzip() - if err != nil { - return 0, err - } - } - - return len(b), nil -} - -// startGzip initialize any GZIP specific informations. -func (w *GzipResponseWriter) startGzip() error { - - // Set the GZIP header. - w.Header().Set(contentEncoding, "gzip") - - // if the Content-Length is already set, then calls to Write on gzip - // will fail to set the Content-Length header since its already set - // See: https://github.com/golang/go/issues/14975. - w.Header().Del(contentLength) - - // Write the header to gzip response. - if w.code != 0 { - w.ResponseWriter.WriteHeader(w.code) - } - - // Initialize the GZIP response. - w.init() - - // Flush the buffer into the gzip response. - n, err := w.gw.Write(w.buf) - - // This should never happen (per io.Writer docs), but if the write didn't - // accept the entire buffer but returned no specific error, we have no clue - // what's going on, so abort just to be safe. - if err == nil && n < len(w.buf) { - return io.ErrShortWrite - } - - w.buf = nil - return err -} - -// WriteHeader just saves the response code until close or GZIP effective writes. -func (w *GzipResponseWriter) WriteHeader(code int) { - w.code = code -} - -// init graps a new gzip writer from the gzipWriterPool and writes the correct -// content encoding header. -func (w *GzipResponseWriter) init() { - // Bytes written during ServeHTTP are redirected to this gzip writer - // before being written to the underlying response. - gzw := gzipWriterPools[w.index].Get().(*gzip.Writer) - gzw.Reset(w.ResponseWriter) - w.gw = gzw -} - -// Close will close the gzip.Writer and will put it back in the gzipWriterPool. -func (w *GzipResponseWriter) Close() error { - if w.gw == nil { - // Gzip not trigged yet, write out regular response. - if w.code != 0 { - w.ResponseWriter.WriteHeader(w.code) - } - if w.buf != nil { - _, writeErr := w.ResponseWriter.Write(w.buf) - // Returns the error if any at write. - if writeErr != nil { - return fmt.Errorf("gziphandler: write to regular responseWriter at close gets error: %q", writeErr.Error()) - } - } - return nil - } - - err := w.gw.Close() - gzipWriterPools[w.index].Put(w.gw) - w.gw = nil - return err -} - -// Flush flushes the underlying *gzip.Writer and then the underlying -// http.ResponseWriter if it is an http.Flusher. This makes GzipResponseWriter -// an http.Flusher. -func (w *GzipResponseWriter) Flush() { - if w.gw != nil { - w.gw.Flush() - } - - if fw, ok := w.ResponseWriter.(http.Flusher); ok { - fw.Flush() - } -} - -// Hijack implements http.Hijacker. If the underlying ResponseWriter is a -// Hijacker, its Hijack method is returned. Otherwise an error is returned. -func (w *GzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { - if hj, ok := w.ResponseWriter.(http.Hijacker); ok { - return hj.Hijack() - } - return nil, nil, fmt.Errorf("http.Hijacker interface is not supported") -} - -// verify Hijacker interface implementation -var _ http.Hijacker = &GzipResponseWriter{} - -// MustNewGzipLevelHandler behaves just like NewGzipLevelHandler except that in -// an error case it panics rather than returning an error. -func MustNewGzipLevelHandler(level int) func(http.Handler) http.Handler { - wrap, err := NewGzipLevelHandler(level) - if err != nil { - panic(err) - } - return wrap -} - -// NewGzipLevelHandler returns a wrapper function (often known as middleware) -// which can be used to wrap an HTTP handler to transparently gzip the response -// body if the client supports it (via the Accept-Encoding header). Responses will -// be encoded at the given gzip compression level. An error will be returned only -// if an invalid gzip compression level is given, so if one can ensure the level -// is valid, the returned error can be safely ignored. -func NewGzipLevelHandler(level int) (func(http.Handler) http.Handler, error) { - return NewGzipLevelAndMinSize(level, DefaultMinSize) -} - -// NewGzipLevelAndMinSize behave as NewGzipLevelHandler except it let the caller -// specify the minimum size before compression. -func NewGzipLevelAndMinSize(level, minSize int) (func(http.Handler) http.Handler, error) { - return GzipHandlerWithOpts(CompressionLevel(level), MinSize(minSize)) -} - -func GzipHandlerWithOpts(opts ...option) (func(http.Handler) http.Handler, error) { - c := &config{ - level: gzip.DefaultCompression, - minSize: DefaultMinSize, - } - - for _, o := range opts { - o(c) - } - - if err := c.validate(); err != nil { - return nil, err - } - - return func(h http.Handler) http.Handler { - index := poolIndex(c.level) - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Add(vary, acceptEncoding) - - if acceptsGzip(r) { - gw := &GzipResponseWriter{ - ResponseWriter: w, - index: index, - minSize: c.minSize, - contentTypes: c.contentTypes, - } - defer gw.Close() - - h.ServeHTTP(gw, r) - } else { - h.ServeHTTP(w, r) - } - }) - }, nil -} - -// Used for functional configuration. -type config struct { - minSize int - level int - contentTypes []string -} - -func (c *config) validate() error { - if c.level != gzip.DefaultCompression && (c.level < gzip.BestSpeed || c.level > gzip.BestCompression) { - return fmt.Errorf("invalid compression level requested: %d", c.level) - } - - if c.minSize < 0 { - return fmt.Errorf("minimum size must be more than zero") - } - - return nil -} - -type option func(c *config) - -func MinSize(size int) option { - return func(c *config) { - c.minSize = size - } -} - -func CompressionLevel(level int) option { - return func(c *config) { - c.level = level - } -} - -func ContentTypes(types []string) option { - return func(c *config) { - c.contentTypes = []string{} - for _, v := range types { - c.contentTypes = append(c.contentTypes, strings.ToLower(v)) - } - } -} - -// GzipHandler wraps an HTTP handler, to transparently gzip the response body if -// the client supports it (via the Accept-Encoding header). This will compress at -// the default compression level. -func GzipHandler(h http.Handler) http.Handler { - wrapper, _ := NewGzipLevelHandler(gzip.DefaultCompression) - return wrapper(h) -} - -// acceptsGzip returns true if the given HTTP request indicates that it will -// accept a gzipped response. -func acceptsGzip(r *http.Request) bool { - acceptedEncodings, _ := parseEncodings(r.Header.Get(acceptEncoding)) - return acceptedEncodings["gzip"] > 0.0 -} - -// returns true if we've been configured to compress the specific content type. -func handleContentType(contentTypes []string, w http.ResponseWriter) bool { - // If contentTypes is empty we handle all content types. - if len(contentTypes) == 0 { - return true - } - - ct := strings.ToLower(w.Header().Get(contentType)) - for _, c := range contentTypes { - if c == ct { - return true - } - } - - return false -} - -// parseEncodings attempts to parse a list of codings, per RFC 2616, as might -// appear in an Accept-Encoding header. It returns a map of content-codings to -// quality values, and an error containing the errors encountered. It's probably -// safe to ignore those, because silently ignoring errors is how the internet -// works. -// -// See: http://tools.ietf.org/html/rfc2616#section-14.3. -func parseEncodings(s string) (codings, error) { - c := make(codings) - var e []string - - for _, ss := range strings.Split(s, ",") { - coding, qvalue, err := parseCoding(ss) - - if err != nil { - e = append(e, err.Error()) - } else { - c[coding] = qvalue - } - } - - // TODO (adammck): Use a proper multi-error struct, so the individual errors - // can be extracted if anyone cares. - if len(e) > 0 { - return c, fmt.Errorf("errors while parsing encodings: %s", strings.Join(e, ", ")) - } - - return c, nil -} - -// parseCoding parses a single conding (content-coding with an optional qvalue), -// as might appear in an Accept-Encoding header. It attempts to forgive minor -// formatting errors. -func parseCoding(s string) (coding string, qvalue float64, err error) { - for n, part := range strings.Split(s, ";") { - part = strings.TrimSpace(part) - qvalue = DefaultQValue - - if n == 0 { - coding = strings.ToLower(part) - } else if strings.HasPrefix(part, "q=") { - qvalue, err = strconv.ParseFloat(strings.TrimPrefix(part, "q="), 64) - - if qvalue < 0.0 { - qvalue = 0.0 - } else if qvalue > 1.0 { - qvalue = 1.0 - } - } - } - - if coding == "" { - err = fmt.Errorf("empty content-coding") - } - - return -} diff --git a/vendor/github.com/NYTimes/gziphandler/gzip_go18.go b/vendor/github.com/NYTimes/gziphandler/gzip_go18.go deleted file mode 100644 index fa9665b7..00000000 --- a/vendor/github.com/NYTimes/gziphandler/gzip_go18.go +++ /dev/null @@ -1,43 +0,0 @@ -// +build go1.8 - -package gziphandler - -import "net/http" - -// Push initiates an HTTP/2 server push. -// Push returns ErrNotSupported if the client has disabled push or if push -// is not supported on the underlying connection. -func (w *GzipResponseWriter) Push(target string, opts *http.PushOptions) error { - pusher, ok := w.ResponseWriter.(http.Pusher) - if ok && pusher != nil { - return pusher.Push(target, setAcceptEncodingForPushOptions(opts)) - } - return http.ErrNotSupported -} - -// setAcceptEncodingForPushOptions sets "Accept-Encoding" : "gzip" for PushOptions without overriding existing headers. -func setAcceptEncodingForPushOptions(opts *http.PushOptions) *http.PushOptions { - - if opts == nil { - opts = &http.PushOptions{ - Header: http.Header{ - acceptEncoding: []string{"gzip"}, - }, - } - return opts - } - - if opts.Header == nil { - opts.Header = http.Header{ - acceptEncoding: []string{"gzip"}, - } - return opts - } - - if encoding := opts.Header.Get(acceptEncoding); encoding == "" { - opts.Header.Add(acceptEncoding, "gzip") - return opts - } - - return opts -} diff --git a/vendor/github.com/NYTimes/gziphandler/gzip_go18_test.go b/vendor/github.com/NYTimes/gziphandler/gzip_go18_test.go deleted file mode 100644 index 412b2918..00000000 --- a/vendor/github.com/NYTimes/gziphandler/gzip_go18_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// +build go1.8 - -package gziphandler - -import ( - "net/http" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestSetAcceptEncodingForPushOptionsWithoutHeaders(t *testing.T) { - var opts *http.PushOptions - opts = setAcceptEncodingForPushOptions(opts) - - assert.NotNil(t, opts) - assert.NotNil(t, opts.Header) - - for k, v := range opts.Header { - assert.Equal(t, "Accept-Encoding", k) - assert.Len(t, v, 1) - assert.Equal(t, "gzip", v[0]) - } - - opts = &http.PushOptions{} - opts = setAcceptEncodingForPushOptions(opts) - - assert.NotNil(t, opts) - assert.NotNil(t, opts.Header) - - for k, v := range opts.Header { - assert.Equal(t, "Accept-Encoding", k) - assert.Len(t, v, 1) - assert.Equal(t, "gzip", v[0]) - } -} - -func TestSetAcceptEncodingForPushOptionsWithHeaders(t *testing.T) { - opts := &http.PushOptions{ - Header: http.Header{ - "User-Agent": []string{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"}, - }, - } - opts = setAcceptEncodingForPushOptions(opts) - - assert.NotNil(t, opts) - assert.NotNil(t, opts.Header) - - assert.Equal(t, "gzip", opts.Header.Get("Accept-Encoding")) - assert.Equal(t, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36", opts.Header.Get("User-Agent")) - - opts = &http.PushOptions{ - Header: http.Header{ - "User-Agent": []string{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"}, - acceptEncoding: []string{"deflate"}, - }, - } - opts = setAcceptEncodingForPushOptions(opts) - - assert.NotNil(t, opts) - assert.NotNil(t, opts.Header) - - e, found := opts.Header["Accept-Encoding"] - if !found { - assert.Fail(t, "Missing Accept-Encoding header value") - } - assert.Len(t, e, 1) - assert.Equal(t, "deflate", e[0]) - assert.Equal(t, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36", opts.Header.Get("User-Agent")) -} diff --git a/vendor/github.com/NYTimes/gziphandler/gzip_test.go b/vendor/github.com/NYTimes/gziphandler/gzip_test.go deleted file mode 100644 index 655a1937..00000000 --- a/vendor/github.com/NYTimes/gziphandler/gzip_test.go +++ /dev/null @@ -1,457 +0,0 @@ -package gziphandler - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "net" - "net/http" - "net/http/httptest" - "net/url" - "strconv" - "testing" - - "github.com/stretchr/testify/assert" -) - -const ( - smallTestBody = "aaabbcaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbccc" - testBody = "aaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbcccaaabbbccc" -) - -func TestParseEncodings(t *testing.T) { - examples := map[string]codings{ - - // Examples from RFC 2616 - "compress, gzip": {"compress": 1.0, "gzip": 1.0}, - "": {}, - "*": {"*": 1.0}, - "compress;q=0.5, gzip;q=1.0": {"compress": 0.5, "gzip": 1.0}, - "gzip;q=1.0, identity; q=0.5, *;q=0": {"gzip": 1.0, "identity": 0.5, "*": 0.0}, - - // More random stuff - "AAA;q=1": {"aaa": 1.0}, - "BBB ; q = 2": {"bbb": 1.0}, - } - - for eg, exp := range examples { - act, _ := parseEncodings(eg) - assert.Equal(t, exp, act) - } -} - -func TestGzipHandler(t *testing.T) { - // This just exists to provide something for GzipHandler to wrap. - handler := newTestHandler(testBody) - - // requests without accept-encoding are passed along as-is - - req1, _ := http.NewRequest("GET", "/whatever", nil) - resp1 := httptest.NewRecorder() - handler.ServeHTTP(resp1, req1) - res1 := resp1.Result() - - assert.Equal(t, 200, res1.StatusCode) - assert.Equal(t, "", res1.Header.Get("Content-Encoding")) - assert.Equal(t, "Accept-Encoding", res1.Header.Get("Vary")) - assert.Equal(t, testBody, resp1.Body.String()) - - // but requests with accept-encoding:gzip are compressed if possible - - req2, _ := http.NewRequest("GET", "/whatever", nil) - req2.Header.Set("Accept-Encoding", "gzip") - resp2 := httptest.NewRecorder() - handler.ServeHTTP(resp2, req2) - res2 := resp2.Result() - - assert.Equal(t, 200, res2.StatusCode) - assert.Equal(t, "gzip", res2.Header.Get("Content-Encoding")) - assert.Equal(t, "Accept-Encoding", res2.Header.Get("Vary")) - assert.Equal(t, gzipStrLevel(testBody, gzip.DefaultCompression), resp2.Body.Bytes()) - - // content-type header is correctly set based on uncompressed body - - req3, _ := http.NewRequest("GET", "/whatever", nil) - req3.Header.Set("Accept-Encoding", "gzip") - res3 := httptest.NewRecorder() - handler.ServeHTTP(res3, req3) - - assert.Equal(t, http.DetectContentType([]byte(testBody)), res3.Header().Get("Content-Type")) -} - -func TestGzipHandlerAlreadyCompressed(t *testing.T) { - handler := newTestHandler(testBody) - - req, _ := http.NewRequest("GET", "/gzipped", nil) - req.Header.Set("Accept-Encoding", "gzip") - res := httptest.NewRecorder() - handler.ServeHTTP(res, req) - - assert.Equal(t, testBody, res.Body.String()) -} - -func TestNewGzipLevelHandler(t *testing.T) { - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - io.WriteString(w, testBody) - }) - - for lvl := gzip.BestSpeed; lvl <= gzip.BestCompression; lvl++ { - wrapper, err := NewGzipLevelHandler(lvl) - if !assert.Nil(t, err, "NewGzipLevleHandler returned error for level:", lvl) { - continue - } - - req, _ := http.NewRequest("GET", "/whatever", nil) - req.Header.Set("Accept-Encoding", "gzip") - resp := httptest.NewRecorder() - wrapper(handler).ServeHTTP(resp, req) - res := resp.Result() - - assert.Equal(t, 200, res.StatusCode) - assert.Equal(t, "gzip", res.Header.Get("Content-Encoding")) - assert.Equal(t, "Accept-Encoding", res.Header.Get("Vary")) - assert.Equal(t, gzipStrLevel(testBody, lvl), resp.Body.Bytes()) - } -} - -func TestNewGzipLevelHandlerReturnsErrorForInvalidLevels(t *testing.T) { - var err error - _, err = NewGzipLevelHandler(-42) - assert.NotNil(t, err) - - _, err = NewGzipLevelHandler(42) - assert.NotNil(t, err) -} - -func TestMustNewGzipLevelHandlerWillPanic(t *testing.T) { - defer func() { - if r := recover(); r == nil { - t.Error("panic was not called") - } - }() - - _ = MustNewGzipLevelHandler(-42) -} - -func TestGzipHandlerNoBody(t *testing.T) { - tests := []struct { - statusCode int - contentEncoding string - bodyLen int - }{ - // Body must be empty. - {http.StatusNoContent, "", 0}, - {http.StatusNotModified, "", 0}, - // Body is going to get gzip'd no matter what. - {http.StatusOK, "", 0}, - } - - for num, test := range tests { - handler := GzipHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(test.statusCode) - })) - - rec := httptest.NewRecorder() - // TODO: in Go1.7 httptest.NewRequest was introduced this should be used - // once 1.6 is not longer supported. - req := &http.Request{ - Method: "GET", - URL: &url.URL{Path: "/"}, - Proto: "HTTP/1.1", - ProtoMinor: 1, - RemoteAddr: "192.0.2.1:1234", - Header: make(http.Header), - } - req.Header.Set("Accept-Encoding", "gzip") - handler.ServeHTTP(rec, req) - - body, err := ioutil.ReadAll(rec.Body) - if err != nil { - t.Fatalf("Unexpected error reading response body: %v", err) - } - - header := rec.Header() - assert.Equal(t, test.contentEncoding, header.Get("Content-Encoding"), fmt.Sprintf("for test iteration %d", num)) - assert.Equal(t, "Accept-Encoding", header.Get("Vary"), fmt.Sprintf("for test iteration %d", num)) - assert.Equal(t, test.bodyLen, len(body), fmt.Sprintf("for test iteration %d", num)) - } -} - -func TestGzipHandlerContentLength(t *testing.T) { - b := []byte(testBody) - handler := GzipHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Length", strconv.Itoa(len(b))) - w.Write(b) - })) - // httptest.NewRecorder doesn't give you access to the Content-Length - // header so instead, we create a server on a random port and make - // a request to that instead - ln, err := net.Listen("tcp", "127.0.0.1:") - if err != nil { - t.Fatalf("failed creating listen socket: %v", err) - } - defer ln.Close() - srv := &http.Server{ - Handler: handler, - } - go srv.Serve(ln) - - req := &http.Request{ - Method: "GET", - URL: &url.URL{Path: "/", Scheme: "http", Host: ln.Addr().String()}, - Header: make(http.Header), - Close: true, - } - req.Header.Set("Accept-Encoding", "gzip") - res, err := http.DefaultClient.Do(req) - if err != nil { - t.Fatalf("Unexpected error making http request: %v", err) - } - defer res.Body.Close() - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatalf("Unexpected error reading response body: %v", err) - } - - l, err := strconv.Atoi(res.Header.Get("Content-Length")) - if err != nil { - t.Fatalf("Unexpected error parsing Content-Length: %v", err) - } - assert.Len(t, body, l) - assert.Equal(t, "gzip", res.Header.Get("Content-Encoding")) - assert.NotEqual(t, b, body) -} - -func TestGzipHandlerMinSizeMustBePositive(t *testing.T) { - _, err := NewGzipLevelAndMinSize(gzip.DefaultCompression, -1) - assert.Error(t, err) -} - -func TestGzipHandlerMinSize(t *testing.T) { - responseLength := 0 - b := []byte{'x'} - - wrapper, _ := NewGzipLevelAndMinSize(gzip.DefaultCompression, 128) - handler := wrapper(http.HandlerFunc( - func(w http.ResponseWriter, r *http.Request) { - // Write responses one byte at a time to ensure that the flush - // mechanism, if used, is working properly. - for i := 0; i < responseLength; i++ { - n, err := w.Write(b) - assert.Equal(t, 1, n) - assert.Nil(t, err) - } - }, - )) - - r, _ := http.NewRequest("GET", "/whatever", &bytes.Buffer{}) - r.Header.Add("Accept-Encoding", "gzip") - - // Short response is not compressed - responseLength = 127 - w := httptest.NewRecorder() - handler.ServeHTTP(w, r) - if w.Result().Header.Get(contentEncoding) == "gzip" { - t.Error("Expected uncompressed response, got compressed") - } - - // Long response is not compressed - responseLength = 128 - w = httptest.NewRecorder() - handler.ServeHTTP(w, r) - if w.Result().Header.Get(contentEncoding) != "gzip" { - t.Error("Expected compressed response, got uncompressed") - } -} - -func TestGzipDoubleClose(t *testing.T) { - // reset the pool for the default compression so we can make sure duplicates - // aren't added back by double close - addLevelPool(gzip.DefaultCompression) - - handler := GzipHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // call close here and it'll get called again interally by - // NewGzipLevelHandler's handler defer - w.Write([]byte("test")) - w.(io.Closer).Close() - })) - - r := httptest.NewRequest("GET", "/", nil) - r.Header.Set("Accept-Encoding", "gzip") - w := httptest.NewRecorder() - handler.ServeHTTP(w, r) - - // the second close shouldn't have added the same writer - // so we pull out 2 writers from the pool and make sure they're different - w1 := gzipWriterPools[poolIndex(gzip.DefaultCompression)].Get() - w2 := gzipWriterPools[poolIndex(gzip.DefaultCompression)].Get() - // assert.NotEqual looks at the value and not the address, so we use regular == - assert.False(t, w1 == w2) -} - -func TestStatusCodes(t *testing.T) { - handler := GzipHandler(http.NotFoundHandler()) - r := httptest.NewRequest("GET", "/", nil) - r.Header.Set("Accept-Encoding", "gzip") - w := httptest.NewRecorder() - handler.ServeHTTP(w, r) - - result := w.Result() - if result.StatusCode != 404 { - t.Errorf("StatusCode should have been 404 but was %d", result.StatusCode) - } -} - -func TestDontWriteWhenNotWrittenTo(t *testing.T) { - // When using gzip as middleware without ANY writes in the handler, - // ensure the gzip middleware doesn't touch the actual ResponseWriter - // either. - - handler0 := GzipHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - })) - - handler1 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - handler0.ServeHTTP(w, r) - w.WriteHeader(404) // this only works if gzip didn't do a WriteHeader(200) - }) - - r := httptest.NewRequest("GET", "/", nil) - r.Header.Set("Accept-Encoding", "gzip") - w := httptest.NewRecorder() - handler1.ServeHTTP(w, r) - - result := w.Result() - if result.StatusCode != 404 { - t.Errorf("StatusCode should have been 404 but was %d", result.StatusCode) - } -} - -var contentTypeTests = []struct { - name string - contentType string - acceptedContentTypes []string - expectedGzip bool -}{ - { - name: "Always gzip when content types are empty", - contentType: "", - acceptedContentTypes: []string{}, - expectedGzip: true, - }, - { - name: "Exact content-type match", - contentType: "application/json", - acceptedContentTypes: []string{"application/json"}, - expectedGzip: true, - }, - { - name: "Case insensitive content-type matching", - contentType: "Application/Json", - acceptedContentTypes: []string{"application/json"}, - expectedGzip: true, - }, - { - name: "Non-matching content-type", - contentType: "text/xml", - acceptedContentTypes: []string{"application/json"}, - expectedGzip: false, - }, -} - -func TestContentTypes(t *testing.T) { - for _, tt := range contentTypeTests { - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", tt.contentType) - io.WriteString(w, testBody) - }) - - wrapper, err := GzipHandlerWithOpts(ContentTypes(tt.acceptedContentTypes)) - if !assert.Nil(t, err, "NewGzipHandlerWithOpts returned error", tt.name) { - continue - } - - req, _ := http.NewRequest("GET", "/whatever", nil) - req.Header.Set("Accept-Encoding", "gzip") - resp := httptest.NewRecorder() - wrapper(handler).ServeHTTP(resp, req) - res := resp.Result() - - assert.Equal(t, 200, res.StatusCode) - if tt.expectedGzip { - assert.Equal(t, "gzip", res.Header.Get("Content-Encoding"), tt.name) - } else { - assert.NotEqual(t, "gzip", res.Header.Get("Content-Encoding"), tt.name) - } - } -} - -// -------------------------------------------------------------------- - -func BenchmarkGzipHandler_S2k(b *testing.B) { benchmark(b, false, 2048) } -func BenchmarkGzipHandler_S20k(b *testing.B) { benchmark(b, false, 20480) } -func BenchmarkGzipHandler_S100k(b *testing.B) { benchmark(b, false, 102400) } -func BenchmarkGzipHandler_P2k(b *testing.B) { benchmark(b, true, 2048) } -func BenchmarkGzipHandler_P20k(b *testing.B) { benchmark(b, true, 20480) } -func BenchmarkGzipHandler_P100k(b *testing.B) { benchmark(b, true, 102400) } - -// -------------------------------------------------------------------- - -func gzipStrLevel(s string, lvl int) []byte { - var b bytes.Buffer - w, _ := gzip.NewWriterLevel(&b, lvl) - io.WriteString(w, s) - w.Close() - return b.Bytes() -} - -func benchmark(b *testing.B, parallel bool, size int) { - bin, err := ioutil.ReadFile("testdata/benchmark.json") - if err != nil { - b.Fatal(err) - } - - req, _ := http.NewRequest("GET", "/whatever", nil) - req.Header.Set("Accept-Encoding", "gzip") - handler := newTestHandler(string(bin[:size])) - - if parallel { - b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - runBenchmark(b, req, handler) - } - }) - } else { - b.ResetTimer() - for i := 0; i < b.N; i++ { - runBenchmark(b, req, handler) - } - } -} - -func runBenchmark(b *testing.B, req *http.Request, handler http.Handler) { - res := httptest.NewRecorder() - handler.ServeHTTP(res, req) - if code := res.Code; code != 200 { - b.Fatalf("Expected 200 but got %d", code) - } else if blen := res.Body.Len(); blen < 500 { - b.Fatalf("Expected complete response body, but got %d bytes", blen) - } -} - -func newTestHandler(body string) http.Handler { - return GzipHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/gzipped": - w.Header().Set("Content-Encoding", "gzip") - io.WriteString(w, body) - default: - io.WriteString(w, body) - } - })) -} diff --git a/vendor/github.com/NYTimes/logrotate/.travis.yml b/vendor/github.com/NYTimes/logrotate/.travis.yml deleted file mode 100644 index 0f99a372..00000000 --- a/vendor/github.com/NYTimes/logrotate/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: go - -go: - - 1.4.2 - - 1.5.2 diff --git a/vendor/github.com/NYTimes/logrotate/LICENSE b/vendor/github.com/NYTimes/logrotate/LICENSE deleted file mode 100644 index df6192d3..00000000 --- a/vendor/github.com/NYTimes/logrotate/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016-2017 The New York Times Company - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/NYTimes/logrotate/README.md b/vendor/github.com/NYTimes/logrotate/README.md deleted file mode 100644 index dfadcd77..00000000 --- a/vendor/github.com/NYTimes/logrotate/README.md +++ /dev/null @@ -1,18 +0,0 @@ -#logrotate file - - [![GoDoc](https://godoc.org/github.com/NYTimes/logrotate?status.svg)](https://godoc.org/github.com/nytimes/logrotate) [![Build Status](https://travis-ci.org/NYTimes/logrotate.svg?branch=master)](https://travis-ci.org/NYTimes/logrotate) - -`logrotated` can be configured to send a `SIGHUP` signal to a process after rotating it's logs. This library reopens the underlying `os.File` when a `SIGHUP` is received by the app. - -###Example -This is will enable all log calls to output to the log file without interruption when `logrotated` rotates the file. - - logfile, err := logrotate.NewFile("/log/path/here") - if err != nil { - log.Fatal(err) - } - - log.SetOutput(logfile) - - -ref: [http://linux.die.net/man/8/logrotate](http://linux.die.net/man/8/logrotate) diff --git a/vendor/github.com/NYTimes/logrotate/logrotate.go b/vendor/github.com/NYTimes/logrotate/logrotate.go deleted file mode 100644 index 1fbb8d18..00000000 --- a/vendor/github.com/NYTimes/logrotate/logrotate.go +++ /dev/null @@ -1,74 +0,0 @@ -package logrotate - -import ( - "fmt" - "os" - "os/signal" - "sync" - "syscall" - "time" -) - -// File wraps an *os.File and listens for a 'SIGHUP' signal from logrotated -// so it can reopen the new file. -type File struct { - *os.File - me sync.Mutex - path string - sighup chan os.Signal -} - -// NewFile creates a File pointer and kicks off the goroutine listening for -// SIGHUP signals. -func NewFile(path string) (*File, error) { - - lr := &File{ - me: sync.Mutex{}, - path: path, - sighup: make(chan os.Signal, 1), - } - - if err := lr.reopen(); err != nil { - return nil, err - } - - go func() { - signal.Notify(lr.sighup, syscall.SIGHUP) - - for _ = range lr.sighup { - fmt.Fprintf(os.Stderr, "%s: Reopening %q\n", time.Now(), lr.path) - if err := lr.reopen(); err != nil { - fmt.Fprintf(os.Stderr, "%s: Error reopening: %s\n", time.Now(), err) - } - } - }() - - return lr, nil - -} - -func (lr *File) reopen() (err error) { - lr.me.Lock() - defer lr.me.Unlock() - lr.File.Close() - lr.File, err = os.OpenFile(lr.path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644) - return -} - -// Write will write to the underlying file. It uses a sync.Mutex to ensure -// uninterrupted writes during logrotates. -func (lr *File) Write(b []byte) (int, error) { - lr.me.Lock() - defer lr.me.Unlock() - return lr.File.Write(b) -} - -// Close will stop the goroutine listening for SIGHUP signals and then close -// the underlying os.File. -func (lr *File) Close() error { - lr.me.Lock() - defer lr.me.Unlock() - signal.Stop(lr.sighup) - close(lr.sighup) - return lr.File.Close() -} diff --git a/vendor/github.com/NYTimes/logrotate/logrotate_test.go b/vendor/github.com/NYTimes/logrotate/logrotate_test.go deleted file mode 100644 index 950a91e7..00000000 --- a/vendor/github.com/NYTimes/logrotate/logrotate_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package logrotate - -import ( - "fmt" - "os" - "syscall" - "testing" - "time" -) - -const TestPath = "/tmp/testfile" - -func TestRotate(t *testing.T) { - - file, err := NewFile(TestPath) - if err != nil { - t.Fatal(err) - } - defer os.Remove(TestPath) - defer os.Remove(TestPath + "2") - defer file.Close() - - go func() { - for { - time.Sleep(100 * time.Millisecond) - fmt.Fprintln(file, "tick") - } - }() - - time.Sleep(time.Second / 2) - - os.Rename(TestPath, TestPath+"2") - - proc, err := os.FindProcess(os.Getpid()) - if err != nil { - t.Error(err) - return - } - - if err := proc.Signal(syscall.SIGHUP); err != nil { - t.Error(err) - return - } - - time.Sleep(time.Second / 2) - -} diff --git a/vendor/github.com/VividCortex/gohistogram/.gitignore b/vendor/github.com/VividCortex/gohistogram/.gitignore deleted file mode 100644 index 4c51178c..00000000 --- a/vendor/github.com/VividCortex/gohistogram/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -\#* -.\#* \ No newline at end of file diff --git a/vendor/github.com/VividCortex/gohistogram/LICENSE b/vendor/github.com/VividCortex/gohistogram/LICENSE deleted file mode 100644 index d23fea36..00000000 --- a/vendor/github.com/VividCortex/gohistogram/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 VividCortex - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/VividCortex/gohistogram/README.md b/vendor/github.com/VividCortex/gohistogram/README.md deleted file mode 100644 index eeb14d36..00000000 --- a/vendor/github.com/VividCortex/gohistogram/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# gohistogram - Histograms in Go - -![build status](https://circleci.com/gh/VividCortex/gohistogram.png?circle-token=d37ec652ea117165cd1b342400a801438f575209) - -This package provides [Streaming Approximate Histograms](https://vividcortex.com/blog/2013/07/08/streaming-approximate-histograms/) -for efficient quantile approximations. - -The histograms in this package are based on the algorithms found in -Ben-Haim & Yom-Tov's *A Streaming Parallel Decision Tree Algorithm* -([PDF](http://jmlr.org/papers/volume11/ben-haim10a/ben-haim10a.pdf)). -Histogram bins do not have a preset size. As values stream into -the histogram, bins are dynamically added and merged. - -Another implementation can be found in the Apache Hive project (see -[NumericHistogram](http://hive.apache.org/docs/r0.11.0/api/org/apache/hadoop/hive/ql/udf/generic/NumericHistogram.html)). - -An example: - -![histogram](http://i.imgur.com/5OplaRs.png) - -The accurate method of calculating quantiles (like percentiles) requires -data to be sorted. Streaming histograms make it possible to approximate -quantiles without sorting (or even individually storing) values. - -NumericHistogram is the more basic implementation of a streaming -histogram. WeightedHistogram implements bin values as exponentially-weighted -moving averages. - -A maximum bin size is passed as an argument to the constructor methods. A -larger bin size yields more accurate approximations at the cost of increased -memory utilization and performance. - -A picture of kittens: - -![stack of kittens](http://i.imgur.com/QxRTWAE.jpg) - -## Getting started - -### Using in your own code - - $ go get github.com/VividCortex/gohistogram - -```go -import "github.com/VividCortex/gohistogram" -``` - -### Running tests and making modifications - -Get the code into your workspace: - - $ cd $GOPATH - $ git clone git@github.com:VividCortex/gohistogram.git ./src/github.com/VividCortex/gohistogram - -You can run the tests now: - - $ cd src/github.com/VividCortex/gohistogram - $ go test . - -## API Documentation - -Full source documentation can be found [here][godoc]. - -[godoc]: http://godoc.org/github.com/VividCortex/gohistogram - -## Contributing - -We only accept pull requests for minor fixes or improvements. This includes: - -* Small bug fixes -* Typos -* Documentation or comments - -Please open issues to discuss new features. Pull requests for new features will be rejected, -so we recommend forking the repository and making changes in your fork for your use case. - -## License - -Copyright (c) 2013 VividCortex - -Released under MIT License. Check `LICENSE` file for details. diff --git a/vendor/github.com/VividCortex/gohistogram/histogram.go b/vendor/github.com/VividCortex/gohistogram/histogram.go deleted file mode 100644 index ede21fd3..00000000 --- a/vendor/github.com/VividCortex/gohistogram/histogram.go +++ /dev/null @@ -1,23 +0,0 @@ -package gohistogram - -// Copyright (c) 2013 VividCortex, Inc. All rights reserved. -// Please see the LICENSE file for applicable license terms. - -// Histogram is the interface that wraps the Add and Quantile methods. -type Histogram interface { - // Add adds a new value, n, to the histogram. Trimming is done - // automatically. - Add(n float64) - - // Quantile returns an approximation. - Quantile(n float64) (q float64) - - // String returns a string reprentation of the histogram, - // which is useful for printing to a terminal. - String() (str string) -} - -type bin struct { - value float64 - count float64 -} diff --git a/vendor/github.com/VividCortex/gohistogram/histogram_test.go b/vendor/github.com/VividCortex/gohistogram/histogram_test.go deleted file mode 100644 index 52f786f8..00000000 --- a/vendor/github.com/VividCortex/gohistogram/histogram_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package gohistogram - -// Copyright (c) 2013 VividCortex, Inc. All rights reserved. -// Please see the LICENSE file for applicable license terms. - -import ( - "math" - "testing" -) - -func approx(x, y float64) bool { - return math.Abs(x-y) < 0.2 -} - -func TestHistogram(t *testing.T) { - h := NewHistogram(160) - for _, val := range testData { - h.Add(float64(val)) - } - if h.Count() != 14999 { - t.Errorf("Expected h.Count() to be 14999, got %v", h.Count()) - } - - if firstQ := h.Quantile(0.25); !approx(firstQ, 14) { - t.Errorf("Expected 25th percentile to be %v, got %v", 14, firstQ) - } - if median := h.Quantile(0.5); !approx(median, 18) { - t.Errorf("Expected 50th percentile to be %v, got %v", 18, median) - } - if thirdQ := h.Quantile(0.75); !approx(thirdQ, 22) { - t.Errorf("Expected 75th percentile to be %v, got %v", 22, thirdQ) - } - if cdf := h.CDF(18); !approx(cdf, 0.5) { - t.Errorf("Expected CDF(median) to be %v, got %v", 0.5, cdf) - } - if cdf := h.CDF(22); !approx(cdf, 0.75) { - t.Errorf("Expected CDF(3rd quartile) to be %v, got %v", 0.75, cdf) - } -} - -func TestWeightedHistogram(t *testing.T) { - h := NewWeightedHistogram(160, 1) - for _, val := range testData { - h.Add(float64(val)) - } - - if firstQ := h.Quantile(0.25); !approx(firstQ, 14) { - t.Errorf("Expected 25th percentile to be %v, got %v", 14, firstQ) - } - if median := h.Quantile(0.5); !approx(median, 18) { - t.Errorf("Expected 50th percentile to be %v, got %v", 18, median) - } - if thirdQ := h.Quantile(0.75); !approx(thirdQ, 22) { - t.Errorf("Expected 75th percentile to be %v, got %v", 22, thirdQ) - } - if cdf := h.CDF(18); !approx(cdf, 0.5) { - t.Errorf("Expected CDF(median) to be %v, got %v", 0.5, cdf) - } - if cdf := h.CDF(22); !approx(cdf, 0.75) { - t.Errorf("Expected CDF(3rd quartile) to be %v, got %v", 0.75, cdf) - } -} diff --git a/vendor/github.com/VividCortex/gohistogram/numerichistogram.go b/vendor/github.com/VividCortex/gohistogram/numerichistogram.go deleted file mode 100644 index 20dea740..00000000 --- a/vendor/github.com/VividCortex/gohistogram/numerichistogram.go +++ /dev/null @@ -1,160 +0,0 @@ -package gohistogram - -// Copyright (c) 2013 VividCortex, Inc. All rights reserved. -// Please see the LICENSE file for applicable license terms. - -import ( - "fmt" -) - -type NumericHistogram struct { - bins []bin - maxbins int - total uint64 -} - -// NewHistogram returns a new NumericHistogram with a maximum of n bins. -// -// There is no "optimal" bin count, but somewhere between 20 and 80 bins -// should be sufficient. -func NewHistogram(n int) *NumericHistogram { - return &NumericHistogram{ - bins: make([]bin, 0), - maxbins: n, - total: 0, - } -} - -func (h *NumericHistogram) Add(n float64) { - defer h.trim() - h.total++ - for i := range h.bins { - if h.bins[i].value == n { - h.bins[i].count++ - return - } - - if h.bins[i].value > n { - - newbin := bin{value: n, count: 1} - head := append(make([]bin, 0), h.bins[0:i]...) - - head = append(head, newbin) - tail := h.bins[i:] - h.bins = append(head, tail...) - return - } - } - - h.bins = append(h.bins, bin{count: 1, value: n}) -} - -func (h *NumericHistogram) Quantile(q float64) float64 { - count := q * float64(h.total) - for i := range h.bins { - count -= float64(h.bins[i].count) - - if count <= 0 { - return h.bins[i].value - } - } - - return -1 -} - -// CDF returns the value of the cumulative distribution function -// at x -func (h *NumericHistogram) CDF(x float64) float64 { - count := 0.0 - for i := range h.bins { - if h.bins[i].value <= x { - count += float64(h.bins[i].count) - } - } - - return count / float64(h.total) -} - -// Mean returns the sample mean of the distribution -func (h *NumericHistogram) Mean() float64 { - if h.total == 0 { - return 0 - } - - sum := 0.0 - - for i := range h.bins { - sum += h.bins[i].value * h.bins[i].count - } - - return sum / float64(h.total) -} - -// Variance returns the variance of the distribution -func (h *NumericHistogram) Variance() float64 { - if h.total == 0 { - return 0 - } - - sum := 0.0 - mean := h.Mean() - - for i := range h.bins { - sum += (h.bins[i].count * (h.bins[i].value - mean) * (h.bins[i].value - mean)) - } - - return sum / float64(h.total) -} - -func (h *NumericHistogram) Count() float64 { - return float64(h.total) -} - -// trim merges adjacent bins to decrease the bin count to the maximum value -func (h *NumericHistogram) trim() { - for len(h.bins) > h.maxbins { - // Find closest bins in terms of value - minDelta := 1e99 - minDeltaIndex := 0 - for i := range h.bins { - if i == 0 { - continue - } - - if delta := h.bins[i].value - h.bins[i-1].value; delta < minDelta { - minDelta = delta - minDeltaIndex = i - } - } - - // We need to merge bins minDeltaIndex-1 and minDeltaIndex - totalCount := h.bins[minDeltaIndex-1].count + h.bins[minDeltaIndex].count - mergedbin := bin{ - value: (h.bins[minDeltaIndex-1].value* - h.bins[minDeltaIndex-1].count + - h.bins[minDeltaIndex].value* - h.bins[minDeltaIndex].count) / - totalCount, // weighted average - count: totalCount, // summed heights - } - head := append(make([]bin, 0), h.bins[0:minDeltaIndex-1]...) - tail := append([]bin{mergedbin}, h.bins[minDeltaIndex+1:]...) - h.bins = append(head, tail...) - } -} - -// String returns a string reprentation of the histogram, -// which is useful for printing to a terminal. -func (h *NumericHistogram) String() (str string) { - str += fmt.Sprintln("Total:", h.total) - - for i := range h.bins { - var bar string - for j := 0; j < int(float64(h.bins[i].count)/float64(h.total)*200); j++ { - bar += "." - } - str += fmt.Sprintln(h.bins[i].value, "\t", bar) - } - - return -} diff --git a/vendor/github.com/VividCortex/gohistogram/sample_data_test.go b/vendor/github.com/VividCortex/gohistogram/sample_data_test.go deleted file mode 100644 index 3952041c..00000000 --- a/vendor/github.com/VividCortex/gohistogram/sample_data_test.go +++ /dev/null @@ -1,15006 +0,0 @@ -package gohistogram - -// Copyright (c) 2013 VividCortex, Inc. All rights reserved. -// Please see the LICENSE file for applicable license terms. - -var testData = []int{ - 8, - 13, - 17, - 16, - 15, - 14, - 14, - 20, - 16, - 54, - 34, - 19, - 15, - 19, - 17, - 14, - 15, - 10, - 10, - 9, - 10, - 12, - 20, - 17, - 12, - 10, - 15, - 15, - 11, - 13, - 16, - 11, - 17, - 17, - 18, - 20, - 25, - 16, - 19, - 31, - 83, - 57, - 10, - 12, - 13, - 19, - 10, - 39, - 20, - 10, - 11, - 3, - 13, - 14, - 15, - 11, - 12, - 17, - 16, - 13, - 15, - 15, - 12, - 16, - 13, - 25, - 14, - 11, - 26, - 24, - 37, - 14, - 15, - 10, - 22, - 16, - 19, - 33, - 11, - 10, - 31, - 18, - 13, - 18, - 11, - 15, - 11, - 19, - 13, - 14, - 12, - 9, - 16, - 24, - 14, - 19, - 16, - 12, - 37, - 17, - 25, - 15, - 15, - 13, - 8, - 18, - 26, - 34, - 9, - 11, - 12, - 29, - 16, - 16, - 8, - 10, - 9, - 22, - 17, - 18, - 19, - 11, - 15, - 13, - 16, - 28, - 17, - 19, - 111, - 117, - 32, - 27, - 14, - 13, - 9, - 14, - 22, - 31, - 18, - 17, - 15, - 16, - 17, - 11, - 11, - 4, - 13, - 17, - 18, - 17, - 11, - 12, - 16, - 16, - 14, - 19, - 18, - 54, - 18, - 15, - 27, - 12, - 10, - 11, - 17, - 24, - 16, - 17, - 12, - 20, - 22, - 9, - 17, - 19, - 30, - 16, - 10, - 12, - 13, - 21, - 14, - 15, - 20, - 21, - 16, - 20, - 9, - 55, - 40, - 12, - 17, - 18, - 20, - 17, - 14, - 35, - 16, - 21, - 26, - 17, - 16, - 9, - 11, - 9, - 9, - 17, - 11, - 17, - 10, - 12, - 12, - 12, - 20, - 14, - 26, - 19, - 36, - 21, - 22, - 12, - 12, - 13, - 14, - 14, - 14, - 20, - 16, - 11, - 18, - 13, - 13, - 16, - 14, - 11, - 12, - 13, - 13, - 13, - 15, - 14, - 16, - 17, - 14, - 11, - 17, - 14, - 29, - 16, - 38, - 17, - 11, - 13, - 17, - 17, - 28, - 15, - 14, - 13, - 19, - 15, - 11, - 15, - 11, - 10, - 16, - 15, - 13, - 14, - 15, - 11, - 16, - 16, - 17, - 9, - 8, - 31, - 100, - 146, - 76, - 12, - 12, - 12, - 14, - 9, - 34, - 11, - 17, - 24, - 16, - 17, - 15, - 15, - 21, - 14, - 18, - 14, - 9, - 22, - 14, - 19, - 18, - 12, - 16, - 7, - 21, - 31, - 19, - 11, - 18, - 15, - 13, - 14, - 12, - 27, - 17, - 15, - 19, - 20, - 23, - 21, - 8, - 23, - 12, - 16, - 14, - 15, - 21, - 12, - 9, - 17, - 20, - 17, - 13, - 25, - 12, - 82, - 48, - 18, - 20, - 24, - 14, - 11, - 15, - 26, - 13, - 17, - 23, - 14, - 32, - 20, - 18, - 11, - 16, - 12, - 15, - 17, - 11, - 14, - 19, - 16, - 14, - 15, - 13, - 17, - 37, - 99, - 30, - 18, - 18, - 12, - 9, - 15, - 15, - 29, - 10, - 16, - 10, - 17, - 15, - 15, - 9, - 9, - 14, - 8, - 17, - 10, - 21, - 22, - 12, - 15, - 18, - 12, - 11, - 15, - 48, - 17, - 29, - 11, - 18, - 21, - 11, - 8, - 13, - 18, - 16, - 11, - 13, - 21, - 19, - 12, - 11, - 15, - 18, - 15, - 17, - 16, - 13, - 17, - 17, - 8, - 8, - 9, - 8, - 17, - 27, - 14, - 14, - 11, - 14, - 19, - 17, - 24, - 13, - 15, - 9, - 12, - 17, - 14, - 18, - 12, - 7, - 10, - 21, - 18, - 13, - 13, - 11, - 27, - 17, - 16, - 23, - 15, - 15, - 72, - 117, - 76, - 26, - 33, - 11, - 13, - 11, - 29, - 75, - 16, - 15, - 15, - 18, - 13, - 11, - 11, - 17, - 4, - 13, - 17, - 12, - 9, - 16, - 28, - 12, - 14, - 11, - 12, - 19, - 70, - 17, - 13, - 13, - 19, - 14, - 11, - 21, - 27, - 9, - 21, - 17, - 17, - 12, - 12, - 14, - 10, - 16, - 16, - 13, - 13, - 17, - 14, - 8, - 12, - 14, - 11, - 20, - 14, - 29, - 32, - 48, - 16, - 12, - 16, - 23, - 11, - 17, - 31, - 17, - 16, - 12, - 14, - 22, - 10, - 12, - 7, - 20, - 9, - 18, - 14, - 17, - 10, - 22, - 17, - 20, - 16, - 14, - 15, - 28, - 18, - 18, - 18, - 15, - 13, - 16, - 17, - 38, - 14, - 6, - 13, - 11, - 23, - 17, - 16, - 9, - 13, - 17, - 13, - 15, - 15, - 20, - 28, - 18, - 22, - 18, - 7, - 15, - 57, - 77, - 30, - 15, - 15, - 16, - 13, - 19, - 14, - 24, - 11, - 21, - 17, - 17, - 11, - 12, - 20, - 17, - 10, - 10, - 13, - 17, - 14, - 10, - 13, - 11, - 20, - 9, - 11, - 12, - 44, - 66, - 30, - 13, - 18, - 15, - 13, - 10, - 28, - 14, - 13, - 11, - 15, - 12, - 13, - 14, - 15, - 12, - 10, - 12, - 11, - 13, - 22, - 17, - 17, - 15, - 14, - 13, - 22, - 17, - 50, - 18, - 13, - 13, - 14, - 14, - 10, - 16, - 18, - 11, - 21, - 13, - 23, - 14, - 25, - 11, - 13, - 8, - 7, - 16, - 14, - 19, - 11, - 10, - 18, - 18, - 8, - 20, - 14, - 18, - 20, - 13, - 20, - 20, - 11, - 12, - 14, - 31, - 13, - 11, - 14, - 8, - 14, - 9, - 13, - 14, - 22, - 20, - 9, - 21, - 7, - 17, - 12, - 13, - 20, - 18, - 15, - 12, - 23, - 33, - 46, - 23, - 15, - 14, - 14, - 17, - 13, - 19, - 20, - 13, - 19, - 15, - 10, - 3, - 14, - 15, - 18, - 15, - 16, - 11, - 22, - 13, - 18, - 18, - 14, - 20, - 13, - 12, - 26, - 11, - 11, - 12, - 12, - 18, - 11, - 9, - 26, - 17, - 18, - 15, - 12, - 14, - 13, - 13, - 11, - 14, - 17, - 15, - 7, - 17, - 19, - 10, - 13, - 11, - 15, - 18, - 22, - 19, - 18, - 20, - 41, - 16, - 16, - 18, - 20, - 18, - 37, - 17, - 15, - 30, - 16, - 16, - 32, - 21, - 12, - 20, - 17, - 19, - 13, - 10, - 17, - 9, - 18, - 21, - 16, - 19, - 12, - 45, - 44, - 24, - 18, - 17, - 14, - 13, - 17, - 18, - 24, - 7, - 26, - 20, - 17, - 14, - 21, - 15, - 16, - 21, - 14, - 14, - 11, - 9, - 15, - 18, - 11, - 17, - 16, - 16, - 19, - 30, - 15, - 18, - 11, - 15, - 13, - 13, - 13, - 20, - 18, - 8, - 14, - 10, - 15, - 8, - 17, - 17, - 17, - 8, - 11, - 18, - 16, - 10, - 16, - 15, - 16, - 12, - 15, - 10, - 31, - 25, - 25, - 13, - 15, - 12, - 16, - 20, - 20, - 19, - 22, - 15, - 14, - 20, - 12, - 14, - 14, - 11, - 11, - 10, - 18, - 14, - 15, - 19, - 10, - 13, - 24, - 12, - 22, - 18, - 80, - 67, - 85, - 14, - 15, - 12, - 18, - 22, - 9, - 17, - 9, - 10, - 9, - 14, - 15, - 13, - 11, - 15, - 21, - 12, - 20, - 18, - 22, - 20, - 14, - 18, - 16, - 15, - 14, - 17, - 21, - 21, - 17, - 13, - 9, - 19, - 12, - 10, - 34, - 13, - 15, - 20, - 11, - 23, - 17, - 11, - 15, - 12, - 15, - 15, - 11, - 19, - 20, - 14, - 14, - 21, - 13, - 17, - 19, - 20, - 60, - 22, - 15, - 12, - 12, - 12, - 10, - 12, - 20, - 10, - 13, - 11, - 21, - 15, - 20, - 16, - 9, - 11, - 17, - 22, - 7, - 15, - 18, - 12, - 17, - 19, - 14, - 17, - 15, - 23, - 23, - 24, - 15, - 18, - 16, - 15, - 21, - 31, - 17, - 21, - 13, - 13, - 10, - 20, - 20, - 21, - 15, - 19, - 16, - 13, - 12, - 16, - 14, - 10, - 15, - 17, - 24, - 16, - 63, - 143, - 109, - 66, - 16, - 15, - 17, - 19, - 15, - 14, - 16, - 12, - 18, - 13, - 18, - 21, - 13, - 12, - 16, - 13, - 19, - 13, - 8, - 17, - 11, - 6, - 13, - 11, - 13, - 20, - 36, - 23, - 20, - 20, - 18, - 19, - 16, - 16, - 19, - 10, - 12, - 17, - 12, - 26, - 14, - 10, - 17, - 12, - 8, - 13, - 10, - 13, - 15, - 15, - 22, - 15, - 22, - 18, - 16, - 36, - 49, - 16, - 20, - 12, - 10, - 16, - 14, - 21, - 15, - 10, - 14, - 13, - 25, - 18, - 17, - 14, - 18, - 23, - 18, - 24, - 14, - 15, - 18, - 28, - 16, - 18, - 23, - 18, - 21, - 76, - 34, - 17, - 14, - 22, - 22, - 21, - 15, - 34, - 16, - 31, - 24, - 22, - 7, - 18, - 13, - 18, - 21, - 14, - 18, - 17, - 18, - 13, - 15, - 16, - 21, - 16, - 23, - 20, - 81, - 124, - 32, - 21, - 17, - 14, - 16, - 20, - 21, - 22, - 19, - 18, - 17, - 17, - 22, - 18, - 11, - 20, - 12, - 22, - 20, - 30, - 16, - 13, - 19, - 18, - 14, - 13, - 56, - 21, - 17, - 18, - 13, - 21, - 26, - 15, - 20, - 15, - 17, - 15, - 13, - 12, - 17, - 15, - 16, - 19, - 12, - 15, - 15, - 12, - 20, - 17, - 19, - 23, - 17, - 20, - 25, - 24, - 24, - 26, - 29, - 25, - 21, - 13, - 24, - 19, - 78, - 22, - 22, - 14, - 24, - 22, - 18, - 15, - 16, - 18, - 7, - 15, - 16, - 13, - 11, - 35, - 21, - 19, - 16, - 19, - 16, - 64, - 38, - 16, - 16, - 21, - 18, - 16, - 13, - 9, - 11, - 16, - 15, - 14, - 13, - 25, - 18, - 18, - 9, - 31, - 13, - 16, - 13, - 19, - 18, - 25, - 9, - 21, - 15, - 20, - 16, - 41, - 62, - 58, - 11, - 23, - 13, - 17, - 16, - 34, - 14, - 15, - 20, - 14, - 20, - 12, - 17, - 13, - 24, - 17, - 18, - 22, - 17, - 19, - 9, - 15, - 19, - 17, - 10, - 17, - 34, - 43, - 32, - 14, - 14, - 12, - 12, - 11, - 16, - 23, - 14, - 13, - 20, - 10, - 15, - 20, - 19, - 19, - 16, - 17, - 22, - 16, - 25, - 19, - 17, - 18, - 16, - 18, - 17, - 13, - 132, - 202, - 174, - 25, - 13, - 20, - 24, - 12, - 33, - 20, - 13, - 16, - 19, - 17, - 13, - 26, - 5, - 11, - 13, - 16, - 22, - 13, - 19, - 15, - 22, - 17, - 22, - 18, - 13, - 54, - 87, - 51, - 13, - 13, - 14, - 17, - 10, - 14, - 32, - 22, - 16, - 13, - 19, - 16, - 19, - 18, - 21, - 16, - 22, - 21, - 18, - 19, - 15, - 24, - 13, - 18, - 16, - 28, - 19, - 38, - 16, - 18, - 17, - 17, - 19, - 11, - 16, - 22, - 18, - 18, - 16, - 15, - 15, - 19, - 18, - 19, - 14, - 14, - 13, - 17, - 14, - 19, - 24, - 16, - 20, - 22, - 9, - 18, - 25, - 26, - 26, - 14, - 13, - 16, - 13, - 13, - 22, - 50, - 17, - 24, - 16, - 24, - 19, - 15, - 19, - 18, - 18, - 18, - 18, - 19, - 8, - 12, - 9, - 21, - 18, - 21, - 19, - 4, - 39, - 32, - 22, - 10, - 22, - 12, - 20, - 15, - 13, - 19, - 15, - 18, - 25, - 16, - 22, - 16, - 18, - 10, - 16, - 19, - 16, - 14, - 10, - 15, - 16, - 16, - 15, - 14, - 9, - 18, - 43, - 12, - 21, - 11, - 18, - 13, - 15, - 16, - 16, - 15, - 20, - 23, - 17, - 18, - 19, - 15, - 13, - 15, - 15, - 17, - 15, - 15, - 19, - 15, - 13, - 23, - 22, - 17, - 9, - 31, - 46, - 30, - 30, - 16, - 18, - 15, - 10, - 21, - 17, - 15, - 15, - 10, - 14, - 13, - 12, - 23, - 18, - 19, - 21, - 17, - 15, - 13, - 13, - 15, - 22, - 17, - 13, - 16, - 20, - 47, - 16, - 23, - 16, - 14, - 11, - 14, - 18, - 23, - 12, - 25, - 17, - 23, - 16, - 16, - 19, - 13, - 14, - 10, - 11, - 16, - 28, - 23, - 19, - 19, - 11, - 15, - 24, - 23, - 31, - 42, - 18, - 18, - 11, - 18, - 14, - 14, - 22, - 21, - 10, - 13, - 17, - 15, - 23, - 16, - 21, - 15, - 11, - 23, - 15, - 18, - 19, - 11, - 17, - 24, - 16, - 22, - 18, - 11, - 84, - 159, - 80, - 12, - 10, - 20, - 23, - 17, - 24, - 55, - 12, - 20, - 7, - 16, - 21, - 12, - 18, - 22, - 18, - 18, - 12, - 16, - 20, - 13, - 19, - 26, - 18, - 22, - 25, - 23, - 33, - 28, - 14, - 21, - 10, - 24, - 25, - 15, - 42, - 18, - 17, - 24, - 37, - 16, - 10, - 11, - 13, - 14, - 24, - 19, - 21, - 22, - 17, - 32, - 15, - 17, - 26, - 18, - 20, - 43, - 49, - 22, - 18, - 20, - 21, - 21, - 18, - 27, - 18, - 17, - 18, - 12, - 20, - 17, - 20, - 17, - 12, - 15, - 24, - 26, - 16, - 15, - 15, - 27, - 17, - 12, - 24, - 20, - 16, - 64, - 32, - 18, - 21, - 37, - 24, - 22, - 19, - 29, - 22, - 18, - 19, - 15, - 14, - 14, - 12, - 14, - 20, - 16, - 16, - 21, - 10, - 16, - 15, - 19, - 22, - 20, - 10, - 13, - 47, - 16, - 27, - 15, - 21, - 14, - 16, - 20, - 26, - 15, - 17, - 19, - 18, - 21, - 23, - 13, - 15, - 10, - 15, - 11, - 18, - 19, - 22, - 15, - 18, - 12, - 24, - 30, - 21, - 18, - 18, - 20, - 16, - 15, - 11, - 10, - 14, - 22, - 15, - 20, - 12, - 17, - 14, - 11, - 20, - 27, - 19, - 14, - 17, - 13, - 15, - 14, - 10, - 12, - 17, - 18, - 11, - 21, - 16, - 35, - 30, - 42, - 31, - 34, - 19, - 24, - 24, - 21, - 21, - 23, - 19, - 17, - 24, - 25, - 16, - 19, - 20, - 19, - 15, - 18, - 21, - 21, - 18, - 27, - 26, - 34, - 26, - 23, - 26, - 130, - 200, - 165, - 90, - 23, - 19, - 31, - 13, - 28, - 16, - 22, - 27, - 16, - 21, - 22, - 24, - 17, - 11, - 13, - 23, - 23, - 26, - 22, - 22, - 17, - 21, - 19, - 26, - 20, - 41, - 107, - 112, - 101, - 34, - 38, - 33, - 34, - 37, - 76, - 31, - 29, - 20, - 44, - 23, - 29, - 24, - 25, - 25, - 27, - 23, - 26, - 35, - 28, - 41, - 24, - 24, - 30, - 36, - 29, - 65, - 43, - 51, - 29, - 26, - 20, - 28, - 21, - 29, - 22, - 20, - 18, - 16, - 15, - 14, - 18, - 21, - 21, - 15, - 21, - 20, - 18, - 18, - 17, - 19, - 20, - 19, - 19, - 13, - 34, - 50, - 29, - 34, - 34, - 31, - 33, - 40, - 39, - 43, - 37, - 31, - 40, - 39, - 41, - 39, - 41, - 48, - 39, - 42, - 44, - 36, - 43, - 39, - 44, - 41, - 37, - 36, - 37, - 39, - 57, - 42, - 45, - 31, - 25, - 28, - 27, - 19, - 27, - 24, - 31, - 23, - 24, - 22, - 24, - 23, - 16, - 14, - 15, - 15, - 15, - 17, - 13, - 17, - 16, - 15, - 19, - 16, - 13, - 18, - 46, - 21, - 24, - 24, - 28, - 29, - 32, - 40, - 56, - 28, - 33, - 35, - 37, - 29, - 31, - 34, - 37, - 34, - 36, - 34, - 36, - 30, - 42, - 36, - 43, - 41, - 47, - 50, - 43, - 70, - 153, - 78, - 42, - 35, - 34, - 41, - 26, - 31, - 54, - 16, - 25, - 27, - 19, - 25, - 15, - 25, - 17, - 15, - 19, - 19, - 24, - 30, - 28, - 12, - 23, - 22, - 34, - 22, - 18, - 64, - 36, - 64, - 55, - 37, - 48, - 47, - 56, - 77, - 49, - 55, - 47, - 54, - 55, - 51, - 57, - 45, - 55, - 49, - 46, - 46, - 39, - 45, - 45, - 51, - 50, - 53, - 45, - 48, - 65, - 78, - 56, - 48, - 43, - 37, - 27, - 28, - 23, - 34, - 26, - 25, - 22, - 26, - 27, - 24, - 23, - 15, - 21, - 22, - 23, - 18, - 17, - 18, - 14, - 19, - 15, - 18, - 13, - 19, - 76, - 143, - 136, - 34, - 28, - 39, - 41, - 53, - 55, - 53, - 56, - 52, - 62, - 56, - 55, - 52, - 57, - 70, - 53, - 58, - 59, - 55, - 65, - 67, - 57, - 57, - 56, - 59, - 55, - 54, - 68, - 60, - 62, - 45, - 49, - 51, - 29, - 32, - 46, - 22, - 20, - 27, - 24, - 29, - 25, - 20, - 27, - 23, - 16, - 22, - 19, - 24, - 19, - 24, - 22, - 18, - 29, - 32, - 24, - 44, - 37, - 51, - 29, - 32, - 40, - 48, - 50, - 62, - 106, - 46, - 65, - 50, - 41, - 62, - 67, - 48, - 53, - 65, - 49, - 61, - 64, - 65, - 46, - 55, - 55, - 68, - 53, - 51, - 59, - 132, - 49, - 59, - 74, - 69, - 51, - 52, - 69, - 80, - 76, - 60, - 61, - 50, - 41, - 46, - 44, - 29, - 30, - 32, - 38, - 18, - 33, - 28, - 21, - 30, - 25, - 29, - 27, - 25, - 41, - 104, - 47, - 26, - 20, - 17, - 25, - 27, - 21, - 32, - 23, - 24, - 29, - 23, - 23, - 30, - 26, - 26, - 23, - 28, - 28, - 29, - 19, - 22, - 26, - 25, - 18, - 23, - 23, - 22, - 29, - 78, - 35, - 30, - 23, - 26, - 25, - 23, - 33, - 20, - 21, - 22, - 27, - 27, - 24, - 24, - 23, - 21, - 33, - 22, - 21, - 25, - 17, - 31, - 32, - 21, - 25, - 15, - 23, - 24, - 102, - 85, - 27, - 24, - 21, - 29, - 25, - 19, - 26, - 22, - 16, - 19, - 29, - 16, - 23, - 20, - 21, - 31, - 22, - 25, - 25, - 22, - 17, - 28, - 28, - 19, - 22, - 24, - 20, - 42, - 53, - 38, - 19, - 20, - 19, - 22, - 20, - 15, - 25, - 28, - 33, - 21, - 26, - 23, - 37, - 20, - 25, - 31, - 22, - 22, - 31, - 17, - 27, - 16, - 20, - 22, - 18, - 29, - 26, - 115, - 95, - 27, - 25, - 25, - 16, - 18, - 18, - 31, - 12, - 5, - 23, - 17, - 10, - 15, - 11, - 16, - 23, - 19, - 30, - 21, - 19, - 22, - 22, - 20, - 19, - 30, - 18, - 28, - 24, - 98, - 119, - 49, - 17, - 12, - 17, - 34, - 21, - 36, - 21, - 20, - 18, - 18, - 15, - 14, - 19, - 19, - 16, - 12, - 25, - 14, - 13, - 19, - 14, - 19, - 13, - 15, - 20, - 20, - 42, - 47, - 33, - 17, - 20, - 19, - 18, - 22, - 17, - 20, - 15, - 22, - 20, - 17, - 26, - 16, - 21, - 24, - 19, - 17, - 22, - 15, - 26, - 16, - 26, - 20, - 16, - 21, - 18, - 21, - 32, - 25, - 23, - 21, - 21, - 21, - 22, - 19, - 31, - 30, - 20, - 18, - 15, - 16, - 38, - 16, - 24, - 21, - 19, - 24, - 24, - 20, - 34, - 26, - 22, - 16, - 27, - 55, - 143, - 115, - 19, - 24, - 19, - 15, - 25, - 18, - 42, - 14, - 18, - 16, - 27, - 14, - 18, - 27, - 23, - 18, - 15, - 22, - 15, - 21, - 13, - 10, - 15, - 15, - 18, - 17, - 11, - 76, - 162, - 142, - 28, - 17, - 23, - 14, - 19, - 25, - 21, - 21, - 20, - 15, - 23, - 26, - 15, - 29, - 13, - 16, - 21, - 16, - 18, - 31, - 9, - 15, - 15, - 13, - 18, - 21, - 27, - 34, - 22, - 21, - 14, - 18, - 23, - 18, - 14, - 21, - 20, - 16, - 19, - 22, - 25, - 16, - 19, - 19, - 20, - 23, - 21, - 17, - 9, - 20, - 16, - 17, - 20, - 24, - 18, - 26, - 76, - 34, - 40, - 15, - 21, - 23, - 13, - 16, - 15, - 20, - 22, - 22, - 15, - 24, - 17, - 15, - 14, - 21, - 8, - 14, - 26, - 14, - 14, - 13, - 13, - 12, - 16, - 19, - 22, - 25, - 40, - 21, - 17, - 16, - 12, - 15, - 17, - 19, - 26, - 17, - 17, - 26, - 19, - 21, - 16, - 22, - 16, - 13, - 21, - 11, - 24, - 17, - 24, - 16, - 21, - 21, - 22, - 16, - 16, - 60, - 28, - 30, - 17, - 13, - 17, - 18, - 18, - 16, - 21, - 21, - 25, - 14, - 26, - 26, - 22, - 22, - 15, - 22, - 24, - 24, - 36, - 12, - 21, - 21, - 29, - 13, - 13, - 22, - 20, - 57, - 15, - 18, - 16, - 24, - 17, - 19, - 12, - 44, - 19, - 23, - 16, - 16, - 21, - 17, - 23, - 13, - 34, - 17, - 27, - 20, - 16, - 20, - 23, - 13, - 22, - 19, - 21, - 17, - 30, - 51, - 46, - 18, - 14, - 18, - 14, - 18, - 20, - 19, - 22, - 19, - 26, - 15, - 17, - 36, - 20, - 22, - 18, - 21, - 22, - 16, - 21, - 19, - 18, - 21, - 16, - 20, - 15, - 23, - 74, - 176, - 216, - 197, - 66, - 20, - 15, - 18, - 20, - 22, - 16, - 17, - 18, - 16, - 24, - 15, - 21, - 16, - 22, - 26, - 17, - 15, - 25, - 26, - 24, - 11, - 17, - 13, - 18, - 22, - 109, - 83, - 54, - 15, - 17, - 14, - 31, - 20, - 33, - 24, - 13, - 18, - 16, - 22, - 14, - 20, - 17, - 17, - 13, - 25, - 16, - 18, - 16, - 13, - 20, - 13, - 20, - 20, - 19, - 46, - 50, - 20, - 19, - 12, - 17, - 23, - 25, - 15, - 30, - 20, - 14, - 19, - 14, - 17, - 21, - 23, - 11, - 21, - 19, - 21, - 17, - 16, - 19, - 9, - 13, - 17, - 15, - 17, - 13, - 26, - 17, - 22, - 12, - 18, - 14, - 21, - 17, - 29, - 17, - 21, - 26, - 15, - 22, - 28, - 16, - 12, - 27, - 21, - 19, - 27, - 23, - 19, - 21, - 13, - 18, - 20, - 31, - 21, - 43, - 98, - 53, - 23, - 19, - 15, - 16, - 6, - 16, - 21, - 13, - 17, - 20, - 20, - 21, - 17, - 17, - 18, - 17, - 17, - 21, - 11, - 15, - 20, - 20, - 19, - 18, - 19, - 26, - 22, - 100, - 144, - 27, - 39, - 23, - 21, - 18, - 18, - 31, - 24, - 24, - 13, - 18, - 21, - 23, - 14, - 15, - 18, - 23, - 22, - 13, - 19, - 19, - 23, - 17, - 19, - 15, - 15, - 28, - 34, - 110, - 153, - 142, - 19, - 18, - 20, - 16, - 22, - 54, - 20, - 21, - 26, - 24, - 15, - 23, - 11, - 20, - 15, - 12, - 22, - 21, - 28, - 22, - 16, - 17, - 28, - 20, - 26, - 18, - 27, - 36, - 21, - 13, - 21, - 15, - 23, - 19, - 22, - 23, - 17, - 18, - 24, - 19, - 25, - 18, - 12, - 13, - 20, - 7, - 15, - 18, - 15, - 14, - 20, - 18, - 15, - 16, - 20, - 24, - 21, - 27, - 19, - 28, - 32, - 24, - 15, - 15, - 57, - 29, - 20, - 16, - 21, - 16, - 23, - 21, - 17, - 20, - 17, - 23, - 18, - 17, - 20, - 20, - 27, - 22, - 17, - 15, - 16, - 69, - 74, - 52, - 49, - 27, - 21, - 20, - 15, - 18, - 21, - 17, - 25, - 15, - 21, - 19, - 17, - 19, - 16, - 22, - 24, - 23, - 20, - 22, - 16, - 23, - 18, - 26, - 12, - 19, - 18, - 36, - 20, - 26, - 14, - 21, - 30, - 16, - 20, - 25, - 20, - 20, - 23, - 20, - 14, - 20, - 21, - 13, - 24, - 16, - 21, - 26, - 21, - 19, - 15, - 14, - 17, - 17, - 17, - 26, - 17, - 61, - 29, - 20, - 11, - 16, - 18, - 21, - 26, - 18, - 18, - 19, - 24, - 30, - 23, - 19, - 23, - 17, - 21, - 19, - 12, - 14, - 13, - 14, - 17, - 19, - 14, - 17, - 23, - 27, - 100, - 29, - 16, - 20, - 22, - 24, - 13, - 16, - 23, - 19, - 16, - 21, - 12, - 16, - 19, - 22, - 17, - 13, - 15, - 19, - 21, - 24, - 16, - 31, - 32, - 22, - 15, - 16, - 18, - 42, - 83, - 31, - 22, - 22, - 46, - 21, - 17, - 15, - 24, - 17, - 22, - 20, - 23, - 28, - 23, - 21, - 16, - 27, - 23, - 26, - 23, - 25, - 17, - 23, - 19, - 16, - 17, - 16, - 17, - 45, - 23, - 18, - 19, - 22, - 18, - 21, - 20, - 45, - 25, - 19, - 27, - 30, - 19, - 20, - 17, - 15, - 10, - 22, - 23, - 15, - 21, - 16, - 23, - 20, - 20, - 17, - 19, - 13, - 48, - 41, - 27, - 13, - 20, - 13, - 15, - 22, - 15, - 17, - 19, - 13, - 22, - 20, - 18, - 17, - 19, - 21, - 21, - 21, - 27, - 12, - 21, - 9, - 15, - 18, - 29, - 23, - 17, - 15, - 27, - 20, - 19, - 15, - 17, - 20, - 16, - 21, - 26, - 12, - 25, - 26, - 16, - 18, - 17, - 24, - 19, - 14, - 10, - 28, - 19, - 22, - 24, - 13, - 18, - 19, - 18, - 17, - 22, - 28, - 43, - 24, - 18, - 17, - 17, - 17, - 16, - 15, - 18, - 20, - 23, - 26, - 17, - 20, - 15, - 15, - 12, - 15, - 21, - 17, - 14, - 12, - 28, - 17, - 14, - 17, - 26, - 18, - 14, - 64, - 20, - 13, - 15, - 13, - 22, - 18, - 30, - 31, - 8, - 17, - 21, - 23, - 14, - 17, - 12, - 18, - 18, - 18, - 19, - 15, - 9, - 23, - 20, - 19, - 19, - 23, - 18, - 19, - 72, - 27, - 21, - 21, - 19, - 20, - 19, - 21, - 10, - 26, - 16, - 17, - 19, - 16, - 19, - 24, - 17, - 22, - 20, - 15, - 14, - 13, - 22, - 14, - 15, - 18, - 18, - 18, - 18, - 17, - 46, - 32, - 11, - 21, - 19, - 13, - 18, - 26, - 28, - 21, - 25, - 25, - 16, - 16, - 30, - 35, - 13, - 17, - 18, - 26, - 15, - 27, - 23, - 25, - 19, - 20, - 19, - 15, - 19, - 48, - 38, - 32, - 17, - 17, - 20, - 18, - 25, - 24, - 35, - 18, - 20, - 14, - 22, - 19, - 26, - 21, - 21, - 17, - 25, - 20, - 26, - 23, - 18, - 15, - 26, - 23, - 19, - 20, - 14, - 38, - 44, - 36, - 24, - 21, - 31, - 23, - 22, - 43, - 23, - 18, - 21, - 20, - 22, - 44, - 17, - 19, - 23, - 20, - 30, - 17, - 21, - 24, - 22, - 35, - 25, - 20, - 21, - 22, - 29, - 93, - 31, - 25, - 32, - 24, - 31, - 25, - 12, - 43, - 22, - 32, - 37, - 28, - 19, - 20, - 19, - 23, - 31, - 18, - 21, - 18, - 35, - 21, - 27, - 23, - 22, - 28, - 31, - 27, - 49, - 34, - 27, - 25, - 27, - 16, - 17, - 28, - 26, - 55, - 25, - 22, - 24, - 19, - 31, - 19, - 21, - 20, - 18, - 28, - 28, - 20, - 31, - 17, - 22, - 20, - 17, - 30, - 17, - 29, - 47, - 35, - 55, - 26, - 28, - 19, - 26, - 22, - 55, - 24, - 25, - 25, - 31, - 27, - 24, - 26, - 20, - 20, - 17, - 19, - 23, - 13, - 24, - 22, - 19, - 17, - 17, - 20, - 18, - 113, - 51, - 25, - 17, - 18, - 27, - 21, - 23, - 27, - 28, - 27, - 19, - 29, - 31, - 24, - 31, - 15, - 17, - 27, - 20, - 22, - 23, - 17, - 25, - 24, - 30, - 19, - 17, - 26, - 71, - 59, - 30, - 24, - 19, - 28, - 24, - 15, - 17, - 17, - 18, - 22, - 20, - 19, - 13, - 19, - 21, - 17, - 22, - 15, - 15, - 16, - 23, - 18, - 20, - 11, - 16, - 17, - 20, - 24, - 76, - 42, - 51, - 17, - 21, - 16, - 8, - 15, - 46, - 13, - 21, - 19, - 22, - 14, - 19, - 18, - 18, - 23, - 18, - 17, - 22, - 20, - 21, - 14, - 16, - 12, - 20, - 16, - 14, - 29, - 90, - 17, - 18, - 17, - 15, - 21, - 18, - 19, - 24, - 19, - 19, - 15, - 16, - 19, - 18, - 25, - 17, - 17, - 16, - 21, - 21, - 19, - 12, - 19, - 19, - 21, - 22, - 20, - 14, - 33, - 24, - 17, - 15, - 20, - 25, - 17, - 24, - 26, - 27, - 21, - 14, - 20, - 26, - 30, - 13, - 19, - 22, - 16, - 19, - 17, - 19, - 26, - 15, - 17, - 20, - 19, - 20, - 20, - 33, - 15, - 24, - 14, - 18, - 20, - 20, - 24, - 18, - 39, - 17, - 19, - 19, - 17, - 20, - 18, - 19, - 16, - 22, - 15, - 21, - 17, - 10, - 19, - 19, - 27, - 15, - 13, - 15, - 19, - 37, - 52, - 14, - 17, - 17, - 18, - 19, - 19, - 27, - 13, - 14, - 15, - 15, - 19, - 14, - 15, - 11, - 15, - 18, - 20, - 18, - 9, - 24, - 18, - 21, - 18, - 11, - 14, - 16, - 13, - 82, - 27, - 51, - 24, - 14, - 19, - 27, - 12, - 16, - 13, - 16, - 21, - 11, - 18, - 18, - 21, - 21, - 12, - 16, - 12, - 13, - 13, - 28, - 10, - 12, - 15, - 23, - 11, - 18, - 24, - 68, - 27, - 21, - 15, - 17, - 15, - 14, - 19, - 39, - 19, - 8, - 20, - 21, - 18, - 10, - 15, - 20, - 11, - 14, - 19, - 11, - 15, - 23, - 28, - 16, - 17, - 11, - 22, - 18, - 67, - 125, - 115, - 73, - 24, - 8, - 19, - 15, - 16, - 16, - 19, - 18, - 14, - 20, - 21, - 20, - 14, - 16, - 11, - 16, - 20, - 11, - 12, - 11, - 17, - 22, - 9, - 14, - 15, - 20, - 78, - 43, - 18, - 15, - 17, - 13, - 19, - 13, - 21, - 13, - 11, - 15, - 17, - 11, - 12, - 12, - 20, - 15, - 14, - 11, - 22, - 10, - 21, - 15, - 13, - 14, - 11, - 20, - 14, - 43, - 28, - 34, - 14, - 13, - 11, - 16, - 16, - 13, - 20, - 14, - 13, - 16, - 22, - 13, - 15, - 19, - 19, - 21, - 22, - 20, - 21, - 18, - 21, - 14, - 21, - 19, - 25, - 18, - 19, - 46, - 16, - 14, - 15, - 13, - 20, - 14, - 17, - 22, - 14, - 18, - 19, - 14, - 17, - 15, - 13, - 17, - 15, - 16, - 20, - 11, - 19, - 18, - 19, - 8, - 13, - 14, - 17, - 11, - 25, - 59, - 21, - 18, - 17, - 15, - 11, - 11, - 12, - 18, - 19, - 10, - 9, - 14, - 18, - 17, - 15, - 26, - 18, - 13, - 13, - 11, - 20, - 19, - 14, - 10, - 15, - 17, - 15, - 14, - 69, - 27, - 16, - 21, - 16, - 17, - 17, - 19, - 18, - 15, - 8, - 15, - 12, - 11, - 18, - 12, - 18, - 11, - 18, - 13, - 21, - 10, - 25, - 21, - 21, - 10, - 11, - 18, - 15, - 21, - 47, - 37, - 54, - 13, - 17, - 18, - 16, - 15, - 40, - 13, - 14, - 17, - 18, - 17, - 15, - 17, - 14, - 25, - 18, - 23, - 13, - 20, - 23, - 17, - 17, - 29, - 11, - 16, - 15, - 39, - 28, - 15, - 9, - 19, - 15, - 13, - 12, - 18, - 17, - 16, - 16, - 29, - 16, - 15, - 17, - 21, - 14, - 16, - 13, - 22, - 24, - 21, - 9, - 18, - 14, - 11, - 15, - 25, - 21, - 47, - 15, - 19, - 18, - 16, - 19, - 16, - 12, - 28, - 19, - 17, - 25, - 19, - 12, - 22, - 15, - 17, - 20, - 14, - 17, - 15, - 19, - 12, - 13, - 10, - 17, - 15, - 20, - 14, - 40, - 19, - 23, - 18, - 19, - 13, - 8, - 12, - 19, - 16, - 22, - 12, - 13, - 14, - 22, - 18, - 15, - 20, - 13, - 16, - 12, - 16, - 27, - 15, - 12, - 23, - 18, - 16, - 15, - 19, - 24, - 34, - 15, - 8, - 12, - 17, - 16, - 12, - 31, - 15, - 17, - 11, - 12, - 15, - 9, - 24, - 20, - 14, - 9, - 19, - 13, - 25, - 19, - 14, - 17, - 10, - 19, - 10, - 15, - 41, - 42, - 75, - 9, - 14, - 14, - 17, - 14, - 19, - 16, - 14, - 15, - 14, - 12, - 14, - 17, - 12, - 15, - 15, - 17, - 16, - 18, - 22, - 22, - 14, - 18, - 12, - 11, - 18, - 13, - 45, - 43, - 18, - 12, - 21, - 17, - 20, - 15, - 27, - 10, - 16, - 24, - 15, - 23, - 26, - 12, - 16, - 18, - 22, - 21, - 7, - 17, - 9, - 11, - 14, - 14, - 15, - 21, - 9, - 23, - 17, - 19, - 14, - 13, - 19, - 13, - 24, - 17, - 39, - 15, - 24, - 20, - 18, - 14, - 12, - 14, - 15, - 14, - 14, - 15, - 11, - 11, - 13, - 17, - 22, - 19, - 12, - 22, - 14, - 23, - 49, - 21, - 14, - 11, - 16, - 13, - 14, - 44, - 19, - 19, - 17, - 12, - 22, - 20, - 14, - 13, - 13, - 14, - 14, - 21, - 16, - 18, - 18, - 13, - 14, - 9, - 24, - 20, - 14, - 120, - 146, - 92, - 12, - 15, - 17, - 12, - 17, - 38, - 18, - 18, - 11, - 15, - 16, - 12, - 11, - 14, - 17, - 14, - 18, - 13, - 19, - 13, - 13, - 16, - 14, - 19, - 12, - 15, - 33, - 75, - 29, - 26, - 13, - 17, - 14, - 14, - 13, - 13, - 17, - 18, - 9, - 19, - 19, - 10, - 12, - 14, - 10, - 21, - 17, - 14, - 20, - 17, - 11, - 17, - 14, - 20, - 13, - 21, - 109, - 129, - 140, - 21, - 22, - 11, - 21, - 11, - 27, - 16, - 21, - 14, - 16, - 17, - 22, - 16, - 21, - 23, - 17, - 20, - 12, - 19, - 23, - 8, - 16, - 20, - 24, - 19, - 22, - 31, - 27, - 40, - 13, - 15, - 22, - 16, - 16, - 18, - 20, - 19, - 17, - 22, - 24, - 18, - 16, - 14, - 14, - 18, - 16, - 20, - 20, - 19, - 17, - 14, - 16, - 13, - 20, - 20, - 23, - 27, - 39, - 33, - 16, - 5, - 25, - 22, - 20, - 32, - 18, - 18, - 19, - 13, - 15, - 23, - 16, - 26, - 21, - 16, - 20, - 21, - 19, - 21, - 18, - 16, - 21, - 25, - 24, - 17, - 20, - 39, - 19, - 20, - 16, - 14, - 23, - 25, - 20, - 37, - 20, - 20, - 21, - 19, - 18, - 24, - 21, - 20, - 21, - 20, - 19, - 22, - 25, - 17, - 12, - 14, - 17, - 19, - 21, - 15, - 60, - 66, - 20, - 18, - 23, - 30, - 20, - 20, - 37, - 15, - 24, - 18, - 19, - 24, - 21, - 18, - 21, - 17, - 27, - 20, - 17, - 18, - 17, - 20, - 18, - 25, - 14, - 21, - 18, - 24, - 68, - 54, - 30, - 24, - 25, - 20, - 20, - 21, - 60, - 21, - 25, - 29, - 23, - 21, - 22, - 26, - 22, - 19, - 16, - 19, - 22, - 36, - 22, - 22, - 13, - 19, - 27, - 21, - 20, - 87, - 126, - 54, - 21, - 23, - 20, - 28, - 13, - 33, - 25, - 21, - 20, - 13, - 20, - 19, - 13, - 23, - 12, - 25, - 17, - 14, - 24, - 17, - 12, - 13, - 16, - 24, - 16, - 19, - 18, - 66, - 29, - 23, - 24, - 15, - 19, - 17, - 17, - 22, - 19, - 17, - 26, - 28, - 15, - 17, - 28, - 20, - 24, - 18, - 20, - 24, - 24, - 15, - 17, - 19, - 26, - 19, - 12, - 24, - 82, - 60, - 44, - 25, - 10, - 18, - 24, - 22, - 17, - 27, - 20, - 25, - 16, - 20, - 26, - 20, - 18, - 28, - 20, - 15, - 13, - 18, - 18, - 18, - 28, - 17, - 18, - 24, - 19, - 24, - 39, - 67, - 20, - 20, - 30, - 18, - 20, - 24, - 38, - 28, - 36, - 18, - 19, - 21, - 20, - 23, - 17, - 22, - 21, - 25, - 25, - 20, - 16, - 28, - 25, - 21, - 21, - 26, - 22, - 39, - 34, - 25, - 23, - 26, - 21, - 17, - 17, - 20, - 28, - 25, - 21, - 25, - 19, - 35, - 21, - 20, - 20, - 24, - 19, - 24, - 20, - 21, - 20, - 18, - 20, - 17, - 17, - 22, - 22, - 60, - 93, - 68, - 13, - 15, - 19, - 26, - 20, - 37, - 27, - 19, - 22, - 21, - 21, - 19, - 23, - 21, - 16, - 18, - 13, - 23, - 26, - 21, - 18, - 18, - 13, - 12, - 20, - 13, - 37, - 47, - 30, - 20, - 21, - 11, - 22, - 23, - 17, - 26, - 21, - 9, - 17, - 19, - 10, - 22, - 21, - 13, - 23, - 15, - 15, - 21, - 22, - 16, - 12, - 12, - 17, - 14, - 18, - 14, - 25, - 21, - 21, - 13, - 26, - 17, - 21, - 23, - 47, - 19, - 18, - 26, - 10, - 21, - 24, - 11, - 25, - 22, - 13, - 18, - 30, - 28, - 16, - 21, - 20, - 13, - 13, - 17, - 15, - 71, - 88, - 45, - 23, - 21, - 15, - 16, - 20, - 19, - 52, - 22, - 17, - 18, - 12, - 21, - 23, - 12, - 16, - 19, - 14, - 10, - 10, - 17, - 17, - 13, - 15, - 21, - 18, - 12, - 12, - 37, - 24, - 20, - 21, - 21, - 13, - 19, - 23, - 25, - 19, - 17, - 20, - 21, - 13, - 15, - 21, - 19, - 23, - 14, - 13, - 12, - 16, - 18, - 16, - 20, - 16, - 19, - 17, - 15, - 22, - 60, - 80, - 112, - 20, - 24, - 15, - 11, - 21, - 21, - 15, - 24, - 15, - 24, - 18, - 18, - 18, - 16, - 21, - 18, - 15, - 10, - 16, - 19, - 19, - 23, - 18, - 15, - 16, - 20, - 35, - 137, - 45, - 14, - 16, - 25, - 17, - 14, - 26, - 16, - 15, - 19, - 11, - 15, - 13, - 18, - 11, - 14, - 15, - 10, - 16, - 15, - 13, - 15, - 10, - 10, - 15, - 13, - 9, - 24, - 7, - 17, - 17, - 14, - 8, - 11, - 15, - 9, - 24, - 14, - 17, - 11, - 9, - 12, - 12, - 17, - 10, - 18, - 18, - 20, - 15, - 12, - 15, - 19, - 19, - 16, - 18, - 13, - 14, - 27, - 37, - 14, - 11, - 15, - 20, - 11, - 14, - 18, - 13, - 15, - 10, - 10, - 19, - 14, - 17, - 12, - 11, - 18, - 4, - 19, - 12, - 11, - 11, - 14, - 14, - 5, - 15, - 15, - 16, - 24, - 16, - 18, - 14, - 13, - 13, - 19, - 17, - 35, - 14, - 16, - 14, - 11, - 15, - 17, - 11, - 18, - 17, - 12, - 7, - 21, - 14, - 20, - 11, - 15, - 15, - 14, - 14, - 18, - 22, - 72, - 36, - 10, - 16, - 17, - 13, - 17, - 8, - 20, - 15, - 11, - 17, - 16, - 8, - 14, - 14, - 14, - 11, - 11, - 12, - 14, - 15, - 16, - 14, - 16, - 17, - 13, - 15, - 16, - 18, - 95, - 25, - 11, - 9, - 12, - 16, - 14, - 29, - 17, - 14, - 17, - 16, - 7, - 7, - 7, - 9, - 16, - 12, - 9, - 12, - 14, - 20, - 10, - 19, - 11, - 20, - 10, - 17, - 17, - 24, - 13, - 13, - 13, - 10, - 16, - 14, - 18, - 29, - 25, - 15, - 10, - 13, - 10, - 9, - 23, - 13, - 19, - 9, - 21, - 13, - 18, - 20, - 21, - 9, - 17, - 16, - 16, - 28, - 36, - 23, - 37, - 25, - 17, - 13, - 22, - 29, - 10, - 22, - 6, - 12, - 28, - 16, - 18, - 16, - 15, - 6, - 13, - 27, - 20, - 12, - 15, - 24, - 14, - 15, - 20, - 24, - 13, - 12, - 40, - 40, - 25, - 22, - 23, - 17, - 20, - 12, - 24, - 24, - 18, - 16, - 15, - 20, - 31, - 21, - 15, - 24, - 22, - 24, - 24, - 18, - 29, - 18, - 20, - 20, - 30, - 20, - 22, - 18, - 47, - 19, - 24, - 25, - 19, - 27, - 20, - 21, - 25, - 18, - 19, - 18, - 18, - 27, - 15, - 24, - 27, - 28, - 16, - 18, - 15, - 17, - 18, - 25, - 16, - 23, - 25, - 24, - 16, - 26, - 64, - 19, - 27, - 15, - 18, - 17, - 19, - 9, - 27, - 9, - 36, - 22, - 17, - 14, - 22, - 17, - 21, - 25, - 16, - 12, - 16, - 20, - 19, - 16, - 20, - 17, - 22, - 15, - 20, - 58, - 71, - 16, - 13, - 24, - 16, - 15, - 18, - 19, - 24, - 17, - 18, - 20, - 12, - 22, - 17, - 18, - 16, - 16, - 19, - 11, - 19, - 16, - 15, - 22, - 24, - 16, - 17, - 16, - 14, - 75, - 69, - 37, - 14, - 21, - 17, - 24, - 20, - 20, - 19, - 26, - 29, - 11, - 17, - 23, - 17, - 22, - 15, - 16, - 18, - 23, - 21, - 15, - 17, - 15, - 18, - 20, - 21, - 16, - 21, - 19, - 27, - 16, - 16, - 17, - 25, - 8, - 16, - 28, - 15, - 12, - 16, - 13, - 18, - 28, - 14, - 25, - 15, - 15, - 16, - 16, - 19, - 13, - 19, - 15, - 18, - 18, - 15, - 16, - 43, - 24, - 15, - 22, - 20, - 23, - 22, - 21, - 26, - 23, - 17, - 19, - 10, - 23, - 28, - 25, - 19, - 14, - 17, - 16, - 14, - 21, - 15, - 15, - 20, - 17, - 19, - 17, - 17, - 24, - 118, - 76, - 31, - 22, - 15, - 10, - 22, - 20, - 41, - 17, - 17, - 18, - 20, - 20, - 18, - 14, - 24, - 14, - 16, - 13, - 16, - 24, - 20, - 20, - 13, - 25, - 16, - 21, - 20, - 38, - 25, - 26, - 20, - 26, - 24, - 15, - 10, - 13, - 26, - 24, - 21, - 19, - 22, - 25, - 16, - 20, - 21, - 16, - 17, - 25, - 19, - 14, - 17, - 17, - 24, - 22, - 20, - 20, - 17, - 81, - 144, - 17, - 24, - 20, - 20, - 15, - 26, - 29, - 20, - 19, - 15, - 6, - 14, - 14, - 13, - 12, - 16, - 17, - 22, - 18, - 15, - 23, - 26, - 19, - 24, - 22, - 16, - 15, - 22, - 25, - 27, - 28, - 17, - 16, - 20, - 18, - 17, - 19, - 16, - 14, - 9, - 12, - 20, - 20, - 12, - 28, - 16, - 16, - 10, - 19, - 26, - 21, - 12, - 27, - 19, - 24, - 18, - 17, - 43, - 18, - 23, - 13, - 20, - 15, - 15, - 17, - 15, - 21, - 20, - 23, - 13, - 18, - 14, - 16, - 19, - 13, - 13, - 11, - 16, - 15, - 18, - 22, - 5, - 16, - 21, - 14, - 25, - 19, - 50, - 27, - 21, - 23, - 17, - 25, - 12, - 19, - 33, - 19, - 20, - 22, - 16, - 22, - 19, - 18, - 12, - 21, - 26, - 15, - 13, - 16, - 20, - 23, - 18, - 19, - 22, - 12, - 15, - 28, - 18, - 35, - 22, - 19, - 20, - 22, - 15, - 21, - 26, - 19, - 19, - 17, - 25, - 19, - 25, - 25, - 15, - 20, - 25, - 16, - 15, - 11, - 15, - 12, - 19, - 16, - 14, - 21, - 18, - 72, - 96, - 21, - 20, - 6, - 16, - 22, - 24, - 12, - 19, - 18, - 21, - 20, - 19, - 17, - 20, - 28, - 22, - 27, - 28, - 25, - 19, - 23, - 24, - 22, - 23, - 17, - 22, - 17, - 21, - 115, - 176, - 182, - 110, - 18, - 20, - 15, - 17, - 48, - 26, - 19, - 14, - 22, - 20, - 17, - 21, - 27, - 19, - 18, - 19, - 27, - 18, - 25, - 12, - 21, - 26, - 19, - 18, - 22, - 47, - 120, - 82, - 25, - 22, - 19, - 17, - 16, - 20, - 59, - 15, - 22, - 24, - 6, - 27, - 24, - 34, - 30, - 18, - 27, - 25, - 16, - 19, - 24, - 31, - 20, - 22, - 19, - 21, - 12, - 46, - 27, - 47, - 18, - 16, - 12, - 20, - 23, - 25, - 20, - 12, - 24, - 19, - 29, - 16, - 17, - 24, - 22, - 22, - 13, - 24, - 18, - 27, - 23, - 26, - 8, - 22, - 23, - 26, - 31, - 102, - 73, - 23, - 13, - 24, - 28, - 20, - 19, - 43, - 16, - 17, - 21, - 24, - 22, - 34, - 23, - 21, - 21, - 18, - 15, - 10, - 19, - 24, - 23, - 21, - 18, - 22, - 22, - 17, - 34, - 20, - 36, - 20, - 22, - 19, - 19, - 17, - 19, - 15, - 18, - 14, - 18, - 24, - 23, - 23, - 11, - 22, - 20, - 18, - 26, - 24, - 16, - 19, - 20, - 22, - 18, - 16, - 22, - 18, - 75, - 19, - 31, - 20, - 15, - 28, - 22, - 21, - 64, - 13, - 24, - 21, - 15, - 18, - 22, - 12, - 21, - 18, - 20, - 21, - 23, - 25, - 22, - 10, - 16, - 23, - 18, - 24, - 10, - 62, - 46, - 24, - 16, - 10, - 18, - 17, - 26, - 20, - 27, - 15, - 20, - 23, - 18, - 27, - 19, - 18, - 17, - 19, - 16, - 25, - 25, - 30, - 19, - 13, - 20, - 15, - 19, - 18, - 28, - 48, - 25, - 19, - 17, - 19, - 17, - 17, - 17, - 43, - 24, - 22, - 24, - 18, - 24, - 21, - 23, - 12, - 22, - 21, - 20, - 14, - 14, - 20, - 19, - 28, - 14, - 16, - 17, - 24, - 29, - 135, - 108, - 24, - 21, - 20, - 22, - 13, - 21, - 45, - 31, - 23, - 22, - 15, - 18, - 11, - 23, - 19, - 15, - 21, - 15, - 13, - 16, - 27, - 18, - 20, - 13, - 16, - 20, - 16, - 51, - 33, - 17, - 18, - 25, - 18, - 12, - 21, - 13, - 20, - 15, - 20, - 15, - 18, - 23, - 21, - 20, - 19, - 11, - 17, - 19, - 13, - 17, - 20, - 15, - 16, - 14, - 21, - 2, - 15, - 60, - 5, - 23, - 22, - 12, - 18, - 20, - 16, - 19, - 24, - 11, - 20, - 15, - 22, - 17, - 19, - 21, - 25, - 18, - 20, - 19, - 13, - 20, - 20, - 14, - 21, - 15, - 22, - 13, - 37, - 33, - 45, - 19, - 23, - 18, - 18, - 21, - 20, - 14, - 19, - 19, - 17, - 28, - 21, - 16, - 22, - 26, - 24, - 16, - 17, - 13, - 21, - 25, - 20, - 14, - 18, - 13, - 17, - 17, - 68, - 16, - 27, - 17, - 13, - 8, - 14, - 18, - 28, - 17, - 22, - 16, - 15, - 13, - 14, - 18, - 13, - 12, - 19, - 19, - 16, - 16, - 24, - 18, - 11, - 20, - 14, - 18, - 16, - 21, - 16, - 31, - 13, - 17, - 18, - 20, - 17, - 20, - 20, - 29, - 16, - 18, - 14, - 12, - 17, - 14, - 13, - 15, - 12, - 18, - 18, - 12, - 18, - 19, - 23, - 25, - 12, - 18, - 13, - 48, - 21, - 2, - 15, - 14, - 23, - 18, - 11, - 22, - 17, - 11, - 19, - 23, - 24, - 20, - 15, - 19, - 22, - 21, - 17, - 23, - 19, - 18, - 23, - 15, - 21, - 11, - 18, - 13, - 20, - 46, - 25, - 23, - 29, - 22, - 21, - 15, - 20, - 34, - 16, - 21, - 21, - 16, - 18, - 20, - 26, - 23, - 20, - 15, - 22, - 17, - 17, - 17, - 18, - 12, - 19, - 15, - 17, - 14, - 29, - 108, - 37, - 18, - 25, - 14, - 23, - 19, - 23, - 28, - 18, - 21, - 20, - 21, - 25, - 14, - 19, - 26, - 18, - 18, - 28, - 17, - 17, - 14, - 23, - 22, - 17, - 20, - 16, - 19, - 55, - 23, - 29, - 22, - 22, - 19, - 22, - 24, - 30, - 27, - 17, - 18, - 19, - 22, - 16, - 16, - 16, - 12, - 16, - 23, - 19, - 12, - 26, - 21, - 20, - 17, - 18, - 23, - 22, - 21, - 94, - 35, - 23, - 15, - 20, - 17, - 23, - 21, - 19, - 26, - 19, - 17, - 22, - 20, - 22, - 18, - 9, - 22, - 19, - 19, - 19, - 17, - 19, - 12, - 21, - 21, - 12, - 21, - 23, - 50, - 54, - 26, - 20, - 17, - 19, - 23, - 23, - 18, - 11, - 20, - 10, - 18, - 17, - 15, - 18, - 28, - 16, - 16, - 16, - 20, - 27, - 26, - 22, - 27, - 21, - 15, - 23, - 14, - 28, - 124, - 95, - 20, - 20, - 19, - 23, - 14, - 24, - 51, - 19, - 20, - 27, - 22, - 18, - 21, - 17, - 21, - 15, - 23, - 16, - 16, - 14, - 18, - 12, - 17, - 19, - 22, - 16, - 17, - 33, - 59, - 34, - 21, - 15, - 27, - 22, - 16, - 26, - 22, - 14, - 22, - 11, - 19, - 12, - 24, - 15, - 17, - 20, - 18, - 22, - 14, - 20, - 15, - 20, - 21, - 24, - 22, - 17, - 22, - 25, - 21, - 25, - 21, - 17, - 12, - 21, - 25, - 33, - 31, - 33, - 22, - 22, - 19, - 17, - 15, - 19, - 23, - 22, - 26, - 18, - 13, - 21, - 17, - 25, - 25, - 24, - 18, - 22, - 25, - 75, - 34, - 25, - 14, - 24, - 15, - 18, - 20, - 28, - 18, - 18, - 21, - 26, - 14, - 12, - 18, - 25, - 20, - 22, - 26, - 20, - 17, - 22, - 14, - 19, - 22, - 22, - 16, - 24, - 75, - 102, - 21, - 12, - 20, - 16, - 11, - 23, - 21, - 20, - 23, - 14, - 25, - 28, - 15, - 20, - 19, - 15, - 24, - 21, - 15, - 22, - 25, - 17, - 11, - 17, - 22, - 19, - 16, - 18, - 63, - 45, - 16, - 20, - 25, - 18, - 24, - 22, - 32, - 19, - 16, - 21, - 18, - 17, - 13, - 17, - 13, - 21, - 20, - 22, - 24, - 18, - 13, - 24, - 21, - 18, - 29, - 19, - 27, - 34, - 19, - 29, - 22, - 19, - 27, - 30, - 11, - 20, - 18, - 19, - 25, - 17, - 22, - 19, - 21, - 12, - 16, - 23, - 13, - 15, - 18, - 14, - 28, - 17, - 18, - 16, - 23, - 29, - 28, - 79, - 17, - 33, - 27, - 25, - 23, - 13, - 26, - 26, - 25, - 25, - 22, - 17, - 17, - 32, - 21, - 15, - 20, - 18, - 16, - 16, - 16, - 15, - 12, - 16, - 23, - 24, - 20, - 29, - 16, - 46, - 32, - 18, - 13, - 22, - 15, - 18, - 15, - 5, - 19, - 17, - 20, - 14, - 19, - 22, - 16, - 17, - 13, - 18, - 18, - 16, - 14, - 23, - 14, - 13, - 19, - 20, - 16, - 15, - 94, - 53, - 22, - 14, - 19, - 20, - 19, - 25, - 16, - 58, - 22, - 26, - 22, - 25, - 19, - 15, - 17, - 20, - 20, - 23, - 19, - 11, - 19, - 17, - 25, - 18, - 19, - 13, - 23, - 25, - 46, - 23, - 23, - 19, - 20, - 20, - 20, - 15, - 37, - 14, - 14, - 15, - 23, - 17, - 22, - 19, - 18, - 21, - 22, - 18, - 21, - 17, - 18, - 16, - 25, - 11, - 18, - 15, - 18, - 47, - 30, - 36, - 22, - 24, - 22, - 19, - 12, - 18, - 30, - 13, - 18, - 21, - 16, - 18, - 19, - 14, - 22, - 20, - 14, - 19, - 19, - 27, - 21, - 17, - 10, - 18, - 26, - 18, - 23, - 80, - 163, - 74, - 15, - 17, - 18, - 17, - 26, - 59, - 20, - 19, - 24, - 21, - 25, - 23, - 18, - 17, - 17, - 16, - 18, - 20, - 17, - 22, - 17, - 20, - 12, - 21, - 25, - 20, - 37, - 105, - 119, - 15, - 20, - 24, - 18, - 23, - 24, - 63, - 64, - 36, - 23, - 20, - 19, - 14, - 17, - 13, - 19, - 19, - 21, - 15, - 17, - 13, - 11, - 18, - 16, - 21, - 15, - 18, - 60, - 32, - 28, - 22, - 20, - 15, - 21, - 20, - 24, - 15, - 15, - 21, - 19, - 20, - 20, - 14, - 15, - 17, - 25, - 16, - 29, - 19, - 16, - 19, - 26, - 14, - 21, - 17, - 14, - 22, - 112, - 34, - 19, - 15, - 14, - 17, - 20, - 15, - 26, - 19, - 11, - 15, - 16, - 28, - 15, - 18, - 17, - 23, - 13, - 10, - 18, - 14, - 26, - 19, - 12, - 15, - 15, - 21, - 19, - 37, - 22, - 22, - 22, - 20, - 20, - 17, - 21, - 34, - 22, - 18, - 16, - 13, - 20, - 16, - 17, - 18, - 20, - 14, - 20, - 21, - 17, - 14, - 16, - 17, - 20, - 20, - 22, - 19, - 13, - 66, - 35, - 24, - 24, - 19, - 16, - 18, - 19, - 30, - 21, - 22, - 21, - 23, - 24, - 18, - 17, - 24, - 23, - 17, - 12, - 17, - 19, - 20, - 21, - 16, - 15, - 25, - 25, - 16, - 34, - 40, - 34, - 23, - 18, - 15, - 14, - 18, - 17, - 65, - 19, - 24, - 27, - 18, - 21, - 26, - 19, - 23, - 24, - 22, - 18, - 22, - 17, - 21, - 17, - 21, - 16, - 14, - 16, - 17, - 51, - 19, - 25, - 14, - 4, - 17, - 16, - 17, - 23, - 18, - 17, - 19, - 16, - 17, - 22, - 22, - 20, - 22, - 12, - 15, - 15, - 10, - 25, - 13, - 9, - 11, - 20, - 18, - 22, - 21, - 64, - 32, - 24, - 22, - 13, - 20, - 20, - 18, - 39, - 20, - 18, - 18, - 28, - 13, - 17, - 20, - 18, - 19, - 13, - 16, - 16, - 21, - 16, - 18, - 16, - 22, - 24, - 22, - 13, - 57, - 5, - 46, - 22, - 16, - 15, - 15, - 13, - 19, - 50, - 19, - 16, - 16, - 19, - 21, - 18, - 16, - 11, - 17, - 20, - 21, - 21, - 17, - 25, - 15, - 14, - 18, - 18, - 20, - 20, - 60, - 18, - 25, - 19, - 22, - 17, - 12, - 19, - 21, - 16, - 20, - 17, - 17, - 19, - 14, - 22, - 17, - 15, - 22, - 14, - 22, - 28, - 15, - 14, - 24, - 25, - 12, - 10, - 20, - 32, - 74, - 25, - 19, - 24, - 13, - 19, - 18, - 16, - 33, - 14, - 9, - 22, - 18, - 19, - 18, - 22, - 19, - 20, - 18, - 14, - 20, - 25, - 16, - 19, - 15, - 23, - 14, - 19, - 18, - 70, - 75, - 26, - 18, - 20, - 13, - 17, - 19, - 30, - 17, - 16, - 18, - 21, - 16, - 22, - 22, - 16, - 15, - 18, - 15, - 21, - 17, - 22, - 14, - 21, - 22, - 21, - 23, - 15, - 22, - 52, - 43, - 33, - 19, - 20, - 16, - 14, - 14, - 21, - 16, - 20, - 13, - 14, - 15, - 17, - 18, - 17, - 21, - 14, - 19, - 15, - 24, - 24, - 9, - 18, - 18, - 20, - 12, - 12, - 56, - 26, - 23, - 18, - 18, - 20, - 20, - 20, - 15, - 50, - 18, - 23, - 23, - 13, - 16, - 23, - 19, - 16, - 20, - 12, - 15, - 13, - 26, - 19, - 15, - 15, - 18, - 23, - 19, - 14, - 31, - 76, - 14, - 16, - 21, - 20, - 15, - 15, - 25, - 26, - 21, - 17, - 21, - 18, - 24, - 20, - 17, - 16, - 20, - 19, - 20, - 18, - 26, - 18, - 14, - 27, - 18, - 21, - 28, - 22, - 112, - 101, - 31, - 22, - 17, - 27, - 15, - 15, - 27, - 13, - 16, - 14, - 18, - 20, - 19, - 24, - 19, - 17, - 14, - 20, - 13, - 20, - 19, - 13, - 20, - 21, - 15, - 12, - 14, - 51, - 25, - 19, - 20, - 22, - 24, - 24, - 18, - 75, - 29, - 13, - 19, - 26, - 23, - 18, - 9, - 10, - 13, - 9, - 19, - 23, - 22, - 16, - 18, - 12, - 15, - 18, - 19, - 20, - 35, - 33, - 14, - 14, - 19, - 17, - 20, - 17, - 20, - 20, - 19, - 16, - 19, - 15, - 19, - 20, - 24, - 20, - 21, - 23, - 19, - 15, - 23, - 18, - 19, - 13, - 20, - 16, - 30, - 9, - 60, - 26, - 23, - 11, - 15, - 16, - 21, - 15, - 17, - 17, - 17, - 15, - 16, - 23, - 22, - 15, - 18, - 13, - 13, - 21, - 12, - 11, - 21, - 17, - 23, - 21, - 19, - 21, - 15, - 43, - 112, - 156, - 100, - 19, - 22, - 23, - 18, - 22, - 30, - 20, - 15, - 16, - 15, - 24, - 20, - 15, - 19, - 15, - 15, - 19, - 15, - 20, - 20, - 18, - 13, - 18, - 16, - 7, - 18, - 76, - 22, - 25, - 23, - 18, - 21, - 19, - 19, - 26, - 16, - 11, - 17, - 16, - 15, - 8, - 23, - 14, - 18, - 19, - 15, - 22, - 13, - 15, - 13, - 23, - 18, - 14, - 31, - 28, - 35, - 36, - 34, - 24, - 12, - 18, - 20, - 12, - 15, - 28, - 9, - 9, - 17, - 10, - 23, - 15, - 15, - 12, - 13, - 17, - 16, - 19, - 18, - 17, - 14, - 22, - 19, - 14, - 23, - 16, - 33, - 29, - 25, - 16, - 21, - 13, - 13, - 16, - 33, - 22, - 19, - 22, - 24, - 18, - 20, - 17, - 17, - 15, - 19, - 22, - 20, - 20, - 16, - 17, - 16, - 20, - 14, - 16, - 15, - 23, - 52, - 102, - 15, - 12, - 17, - 23, - 25, - 14, - 26, - 21, - 19, - 22, - 12, - 13, - 25, - 22, - 29, - 17, - 15, - 13, - 19, - 19, - 16, - 13, - 14, - 18, - 12, - 18, - 14, - 55, - 42, - 46, - 15, - 14, - 16, - 12, - 13, - 11, - 20, - 22, - 20, - 13, - 16, - 13, - 20, - 18, - 14, - 18, - 20, - 15, - 24, - 13, - 17, - 16, - 18, - 19, - 22, - 14, - 19, - 41, - 36, - 18, - 9, - 17, - 20, - 12, - 21, - 15, - 25, - 16, - 18, - 20, - 21, - 13, - 19, - 13, - 22, - 20, - 21, - 16, - 18, - 9, - 14, - 18, - 20, - 11, - 20, - 18, - 39, - 27, - 25, - 22, - 20, - 20, - 22, - 14, - 19, - 22, - 19, - 20, - 15, - 24, - 21, - 21, - 21, - 25, - 23, - 17, - 14, - 21, - 16, - 15, - 20, - 17, - 15, - 16, - 22, - 32, - 59, - 17, - 17, - 8, - 20, - 20, - 18, - 24, - 32, - 20, - 14, - 20, - 15, - 16, - 13, - 16, - 25, - 24, - 25, - 19, - 20, - 8, - 15, - 16, - 16, - 17, - 21, - 18, - 19, - 43, - 39, - 24, - 22, - 17, - 26, - 21, - 21, - 20, - 36, - 16, - 13, - 18, - 16, - 15, - 25, - 16, - 23, - 14, - 18, - 22, - 28, - 23, - 16, - 27, - 20, - 23, - 20, - 15, - 18, - 36, - 20, - 16, - 19, - 24, - 18, - 25, - 22, - 25, - 22, - 11, - 13, - 14, - 18, - 20, - 14, - 17, - 16, - 10, - 15, - 16, - 19, - 13, - 17, - 22, - 26, - 21, - 20, - 15, - 48, - 35, - 54, - 14, - 20, - 17, - 15, - 21, - 13, - 27, - 21, - 16, - 16, - 16, - 14, - 16, - 17, - 22, - 15, - 21, - 16, - 12, - 16, - 20, - 14, - 20, - 18, - 17, - 15, - 19, - 48, - 101, - 38, - 26, - 17, - 23, - 17, - 16, - 19, - 17, - 19, - 22, - 18, - 18, - 20, - 19, - 18, - 21, - 18, - 9, - 15, - 12, - 21, - 18, - 18, - 12, - 17, - 19, - 27, - 9, - 55, - 28, - 23, - 13, - 21, - 21, - 27, - 22, - 31, - 11, - 19, - 13, - 14, - 18, - 12, - 20, - 15, - 25, - 14, - 26, - 23, - 20, - 23, - 27, - 22, - 22, - 18, - 23, - 27, - 29, - 73, - 28, - 15, - 18, - 26, - 14, - 19, - 15, - 24, - 19, - 19, - 19, - 20, - 14, - 18, - 22, - 19, - 15, - 17, - 21, - 11, - 18, - 22, - 23, - 20, - 24, - 21, - 28, - 22, - 85, - 37, - 22, - 18, - 20, - 19, - 22, - 15, - 41, - 26, - 14, - 29, - 16, - 16, - 17, - 19, - 19, - 15, - 16, - 13, - 23, - 16, - 21, - 12, - 15, - 17, - 27, - 13, - 16, - 61, - 120, - 101, - 19, - 21, - 16, - 27, - 10, - 14, - 15, - 23, - 24, - 18, - 16, - 16, - 18, - 22, - 14, - 16, - 19, - 15, - 12, - 21, - 17, - 14, - 18, - 18, - 19, - 23, - 20, - 43, - 21, - 24, - 22, - 21, - 16, - 22, - 15, - 28, - 15, - 11, - 17, - 18, - 17, - 16, - 19, - 10, - 15, - 11, - 17, - 18, - 19, - 22, - 14, - 21, - 17, - 23, - 13, - 17, - 56, - 28, - 30, - 13, - 17, - 26, - 18, - 20, - 30, - 18, - 20, - 23, - 12, - 18, - 14, - 21, - 22, - 20, - 16, - 15, - 15, - 23, - 23, - 13, - 17, - 11, - 19, - 22, - 17, - 13, - 117, - 110, - 21, - 22, - 17, - 17, - 18, - 17, - 47, - 17, - 14, - 16, - 18, - 21, - 21, - 17, - 10, - 17, - 15, - 19, - 15, - 19, - 21, - 24, - 20, - 23, - 19, - 23, - 21, - 61, - 147, - 141, - 27, - 18, - 10, - 18, - 18, - 19, - 25, - 17, - 15, - 17, - 17, - 20, - 15, - 12, - 13, - 20, - 22, - 23, - 14, - 25, - 19, - 17, - 20, - 16, - 18, - 25, - 27, - 61, - 15, - 19, - 16, - 18, - 20, - 18, - 13, - 37, - 19, - 13, - 13, - 23, - 19, - 20, - 13, - 16, - 20, - 24, - 17, - 16, - 14, - 17, - 14, - 17, - 19, - 16, - 17, - 12, - 39, - 60, - 29, - 17, - 21, - 15, - 24, - 19, - 18, - 21, - 24, - 13, - 15, - 16, - 23, - 20, - 15, - 23, - 24, - 22, - 12, - 18, - 21, - 20, - 21, - 16, - 20, - 18, - 20, - 16, - 72, - 61, - 34, - 11, - 25, - 19, - 17, - 24, - 33, - 23, - 11, - 21, - 21, - 16, - 17, - 22, - 21, - 14, - 19, - 13, - 17, - 17, - 20, - 24, - 22, - 2, - 7, - 19, - 13, - 35, - 141, - 136, - 18, - 18, - 21, - 20, - 20, - 24, - 23, - 15, - 22, - 13, - 22, - 20, - 23, - 18, - 20, - 17, - 25, - 12, - 16, - 22, - 24, - 22, - 19, - 13, - 19, - 19, - 26, - 50, - 27, - 50, - 32, - 26, - 15, - 14, - 17, - 23, - 15, - 18, - 20, - 20, - 26, - 27, - 25, - 20, - 17, - 14, - 20, - 14, - 15, - 18, - 16, - 12, - 25, - 21, - 13, - 13, - 16, - 109, - 24, - 20, - 16, - 18, - 11, - 14, - 15, - 18, - 17, - 18, - 20, - 18, - 19, - 22, - 19, - 15, - 22, - 22, - 17, - 20, - 18, - 20, - 20, - 19, - 18, - 18, - 17, - 22, - 35, - 61, - 31, - 7, - 19, - 12, - 14, - 18, - 20, - 29, - 18, - 25, - 21, - 11, - 16, - 19, - 21, - 10, - 19, - 15, - 21, - 17, - 19, - 17, - 11, - 19, - 19, - 20, - 22, - 17, - 66, - 99, - 115, - 31, - 19, - 17, - 18, - 16, - 30, - 25, - 16, - 19, - 15, - 21, - 23, - 19, - 18, - 15, - 15, - 22, - 20, - 15, - 24, - 27, - 15, - 20, - 22, - 18, - 14, - 20, - 52, - 19, - 19, - 18, - 19, - 26, - 29, - 15, - 50, - 24, - 18, - 24, - 10, - 25, - 16, - 16, - 18, - 27, - 16, - 19, - 22, - 24, - 21, - 22, - 17, - 20, - 17, - 19, - 17, - 60, - 26, - 16, - 20, - 22, - 17, - 17, - 22, - 20, - 21, - 20, - 15, - 17, - 18, - 17, - 25, - 19, - 15, - 18, - 17, - 16, - 14, - 32, - 27, - 14, - 17, - 19, - 21, - 20, - 20, - 69, - 26, - 21, - 11, - 16, - 14, - 20, - 20, - 25, - 26, - 9, - 13, - 15, - 20, - 21, - 11, - 10, - 16, - 14, - 17, - 22, - 19, - 15, - 17, - 23, - 20, - 15, - 20, - 14, - 28, - 33, - 27, - 17, - 21, - 16, - 23, - 23, - 21, - 23, - 19, - 14, - 13, - 14, - 19, - 15, - 22, - 15, - 19, - 16, - 14, - 16, - 13, - 18, - 16, - 16, - 11, - 10, - 19, - 13, - 47, - 26, - 23, - 23, - 16, - 21, - 19, - 15, - 22, - 20, - 21, - 17, - 25, - 22, - 14, - 22, - 27, - 18, - 21, - 22, - 18, - 19, - 19, - 19, - 25, - 18, - 23, - 22, - 21, - 22, - 75, - 29, - 25, - 21, - 24, - 26, - 20, - 31, - 44, - 23, - 25, - 16, - 16, - 21, - 7, - 19, - 12, - 23, - 18, - 19, - 23, - 21, - 22, - 19, - 13, - 13, - 22, - 21, - 17, - 38, - 64, - 35, - 19, - 17, - 27, - 19, - 12, - 19, - 43, - 17, - 16, - 22, - 18, - 17, - 18, - 19, - 16, - 21, - 19, - 18, - 18, - 21, - 21, - 23, - 17, - 12, - 13, - 20, - 18, - 88, - 100, - 87, - 21, - 26, - 18, - 20, - 21, - 39, - 14, - 19, - 20, - 19, - 24, - 27, - 20, - 21, - 20, - 30, - 20, - 23, - 21, - 26, - 26, - 23, - 17, - 23, - 19, - 23, - 17, - 43, - 54, - 30, - 20, - 20, - 18, - 18, - 29, - 43, - 24, - 16, - 29, - 21, - 22, - 18, - 28, - 18, - 23, - 17, - 16, - 27, - 25, - 14, - 23, - 22, - 24, - 21, - 21, - 27, - 52, - 54, - 15, - 21, - 15, - 23, - 28, - 23, - 41, - 18, - 21, - 14, - 14, - 20, - 21, - 29, - 19, - 18, - 18, - 24, - 16, - 18, - 22, - 17, - 22, - 21, - 22, - 15, - 22, - 23, - 53, - 118, - 96, - 26, - 21, - 21, - 21, - 19, - 26, - 17, - 18, - 24, - 20, - 27, - 21, - 31, - 20, - 16, - 21, - 17, - 14, - 31, - 23, - 10, - 19, - 20, - 10, - 18, - 18, - 41, - 35, - 19, - 26, - 17, - 17, - 13, - 26, - 20, - 31, - 18, - 17, - 31, - 4, - 27, - 21, - 22, - 19, - 13, - 28, - 16, - 21, - 21, - 24, - 17, - 14, - 18, - 18, - 22, - 30, - 84, - 81, - 51, - 19, - 19, - 17, - 17, - 18, - 62, - 44, - 16, - 21, - 20, - 24, - 22, - 15, - 18, - 21, - 20, - 17, - 20, - 23, - 22, - 32, - 19, - 14, - 14, - 16, - 19, - 51, - 101, - 33, - 20, - 16, - 22, - 18, - 19, - 19, - 20, - 20, - 20, - 17, - 17, - 22, - 19, - 12, - 20, - 16, - 13, - 18, - 17, - 14, - 11, - 16, - 25, - 16, - 17, - 20, - 22, - 17, - 21, - 24, - 22, - 8, - 20, - 17, - 20, - 33, - 17, - 25, - 20, - 24, - 19, - 14, - 31, - 15, - 22, - 19, - 19, - 22, - 22, - 4, - 22, - 27, - 21, - 24, - 24, - 18, - 54, - 66, - 44, - 24, - 22, - 22, - 21, - 23, - 19, - 37, - 19, - 24, - 19, - 20, - 18, - 21, - 20, - 16, - 19, - 12, - 25, - 23, - 21, - 15, - 20, - 17, - 18, - 21, - 18, - 14, - 67, - 82, - 23, - 19, - 16, - 14, - 13, - 15, - 22, - 26, - 5, - 18, - 24, - 26, - 20, - 19, - 19, - 15, - 20, - 25, - 14, - 20, - 15, - 17, - 19, - 16, - 19, - 12, - 14, - 16, - 36, - 24, - 14, - 13, - 22, - 19, - 28, - 22, - 61, - 23, - 23, - 24, - 18, - 17, - 11, - 18, - 14, - 21, - 20, - 26, - 22, - 12, - 21, - 13, - 17, - 23, - 17, - 16, - 15, - 30, - 6, - 24, - 17, - 21, - 16, - 19, - 19, - 37, - 74, - 50, - 17, - 23, - 23, - 16, - 13, - 20, - 21, - 25, - 24, - 19, - 16, - 22, - 24, - 19, - 13, - 13, - 26, - 23, - 20, - 41, - 29, - 8, - 13, - 19, - 18, - 15, - 10, - 41, - 18, - 15, - 16, - 13, - 10, - 24, - 15, - 17, - 21, - 19, - 21, - 18, - 15, - 18, - 18, - 25, - 15, - 23, - 18, - 24, - 42, - 61, - 41, - 17, - 25, - 13, - 18, - 18, - 27, - 15, - 16, - 16, - 16, - 13, - 18, - 16, - 18, - 15, - 20, - 30, - 18, - 28, - 22, - 17, - 19, - 23, - 18, - 15, - 16, - 16, - 85, - 117, - 29, - 12, - 17, - 21, - 16, - 21, - 38, - 18, - 11, - 15, - 13, - 16, - 24, - 19, - 18, - 17, - 15, - 18, - 15, - 20, - 21, - 19, - 22, - 23, - 20, - 15, - 22, - 34, - 107, - 58, - 19, - 15, - 28, - 18, - 16, - 10, - 48, - 19, - 15, - 24, - 28, - 14, - 13, - 22, - 19, - 16, - 9, - 24, - 18, - 21, - 17, - 17, - 27, - 18, - 19, - 18, - 17, - 111, - 150, - 95, - 18, - 20, - 16, - 23, - 16, - 33, - 10, - 22, - 22, - 19, - 24, - 23, - 29, - 14, - 23, - 26, - 21, - 22, - 11, - 23, - 18, - 35, - 26, - 14, - 21, - 19, - 18, - 30, - 35, - 8, - 12, - 25, - 15, - 13, - 21, - 20, - 18, - 19, - 15, - 18, - 19, - 22, - 18, - 12, - 24, - 22, - 8, - 32, - 14, - 19, - 20, - 15, - 17, - 21, - 23, - 22, - 36, - 47, - 26, - 23, - 20, - 9, - 21, - 18, - 29, - 20, - 20, - 28, - 25, - 23, - 23, - 19, - 19, - 21, - 22, - 16, - 19, - 20, - 14, - 23, - 14, - 18, - 12, - 18, - 19, - 50, - 146, - 30, - 15, - 18, - 18, - 25, - 16, - 38, - 22, - 17, - 14, - 16, - 21, - 28, - 18, - 20, - 19, - 17, - 15, - 20, - 21, - 16, - 18, - 33, - 14, - 15, - 19, - 15, - 20, - 44, - 12, - 13, - 16, - 20, - 18, - 16, - 12, - 44, - 13, - 24, - 23, - 10, - 21, - 13, - 15, - 13, - 10, - 31, - 17, - 20, - 13, - 18, - 18, - 16, - 18, - 12, - 20, - 11, - 29, - 28, - 42, - 15, - 12, - 16, - 24, - 19, - 15, - 18, - 9, - 20, - 13, - 19, - 12, - 14, - 22, - 16, - 17, - 12, - 12, - 17, - 13, - 13, - 28, - 14, - 14, - 15, - 19, - 15, - 35, - 24, - 17, - 14, - 18, - 15, - 19, - 13, - 52, - 19, - 20, - 17, - 22, - 19, - 21, - 16, - 15, - 11, - 18, - 17, - 14, - 14, - 13, - 16, - 18, - 15, - 15, - 20, - 12, - 21, - 92, - 16, - 10, - 7, - 8, - 14, - 15, - 14, - 42, - 18, - 6, - 13, - 18, - 16, - 14, - 12, - 18, - 11, - 14, - 9, - 18, - 14, - 24, - 17, - 9, - 18, - 20, - 21, - 10, - 47, - 150, - 89, - 19, - 16, - 19, - 28, - 13, - 21, - 19, - 21, - 12, - 15, - 13, - 29, - 19, - 11, - 14, - 15, - 10, - 15, - 16, - 19, - 24, - 21, - 16, - 17, - 14, - 11, - 11, - 30, - 17, - 14, - 18, - 14, - 16, - 11, - 22, - 18, - 12, - 15, - 20, - 15, - 14, - 20, - 17, - 18, - 22, - 15, - 11, - 20, - 15, - 19, - 9, - 13, - 16, - 14, - 23, - 22, - 30, - 34, - 20, - 13, - 22, - 16, - 18, - 21, - 17, - 49, - 11, - 22, - 15, - 11, - 20, - 14, - 11, - 17, - 12, - 13, - 15, - 23, - 12, - 9, - 20, - 15, - 13, - 15, - 14, - 15, - 69, - 28, - 23, - 13, - 14, - 20, - 19, - 19, - 21, - 16, - 11, - 17, - 16, - 13, - 13, - 13, - 15, - 12, - 14, - 11, - 18, - 20, - 11, - 18, - 7, - 16, - 10, - 19, - 14, - 29, - 25, - 16, - 15, - 11, - 9, - 13, - 15, - 15, - 65, - 15, - 18, - 15, - 24, - 18, - 20, - 15, - 18, - 17, - 25, - 25, - 15, - 16, - 16, - 17, - 28, - 18, - 17, - 16, - 13, - 81, - 60, - 68, - 13, - 15, - 16, - 13, - 23, - 16, - 19, - 10, - 18, - 16, - 16, - 21, - 18, - 20, - 20, - 22, - 19, - 9, - 17, - 11, - 17, - 18, - 18, - 11, - 19, - 13, - 14, - 53, - 17, - 20, - 13, - 18, - 3, - 11, - 14, - 17, - 17, - 19, - 21, - 18, - 19, - 20, - 13, - 13, - 18, - 12, - 11, - 21, - 16, - 27, - 15, - 15, - 13, - 15, - 18, - 14, - 65, - 32, - 21, - 17, - 15, - 10, - 15, - 14, - 15, - 19, - 18, - 17, - 17, - 19, - 24, - 21, - 22, - 17, - 11, - 16, - 12, - 13, - 18, - 23, - 22, - 29, - 19, - 10, - 12, - 18, - 94, - 86, - 29, - 13, - 20, - 21, - 16, - 17, - 27, - 20, - 23, - 20, - 17, - 17, - 21, - 19, - 12, - 15, - 24, - 27, - 16, - 21, - 22, - 15, - 19, - 13, - 17, - 17, - 19, - 23, - 37, - 23, - 18, - 10, - 10, - 20, - 18, - 21, - 33, - 21, - 18, - 22, - 23, - 24, - 26, - 22, - 25, - 28, - 22, - 16, - 15, - 21, - 14, - 15, - 21, - 12, - 14, - 21, - 15, - 57, - 49, - 27, - 27, - 27, - 22, - 16, - 26, - 14, - 36, - 23, - 20, - 24, - 23, - 29, - 28, - 18, - 28, - 16, - 23, - 24, - 21, - 16, - 19, - 24, - 19, - 17, - 23, - 22, - 23, - 111, - 25, - 34, - 23, - 17, - 22, - 10, - 29, - 43, - 21, - 12, - 24, - 18, - 16, - 16, - 22, - 19, - 20, - 21, - 13, - 18, - 12, - 14, - 13, - 19, - 15, - 25, - 21, - 23, - 82, - 25, - 17, - 15, - 26, - 18, - 19, - 20, - 15, - 28, - 25, - 22, - 18, - 25, - 14, - 17, - 14, - 18, - 15, - 14, - 12, - 17, - 23, - 16, - 17, - 18, - 19, - 7, - 20, - 18, - 31, - 54, - 20, - 20, - 21, - 11, - 13, - 12, - 41, - 13, - 14, - 21, - 16, - 14, - 17, - 24, - 21, - 23, - 19, - 20, - 15, - 19, - 23, - 15, - 17, - 26, - 22, - 17, - 30, - 39, - 60, - 27, - 15, - 20, - 14, - 14, - 22, - 13, - 57, - 21, - 10, - 23, - 14, - 20, - 21, - 16, - 14, - 14, - 14, - 26, - 21, - 10, - 13, - 20, - 15, - 21, - 19, - 18, - 22, - 64, - 76, - 17, - 20, - 14, - 17, - 19, - 11, - 27, - 18, - 21, - 20, - 10, - 18, - 21, - 26, - 21, - 10, - 17, - 21, - 29, - 33, - 19, - 29, - 26, - 23, - 19, - 23, - 16, - 22, - 70, - 44, - 50, - 20, - 23, - 14, - 20, - 27, - 76, - 31, - 12, - 21, - 12, - 16, - 22, - 15, - 13, - 18, - 12, - 23, - 21, - 13, - 21, - 11, - 14, - 10, - 21, - 19, - 10, - 36, - 32, - 9, - 20, - 12, - 14, - 8, - 9, - 22, - 15, - 17, - 12, - 25, - 13, - 12, - 19, - 18, - 14, - 20, - 17, - 17, - 13, - 18, - 18, - 9, - 17, - 12, - 14, - 19, - 11, - 46, - 14, - 38, - 16, - 15, - 8, - 21, - 28, - 39, - 52, - 21, - 13, - 20, - 13, - 19, - 10, - 14, - 19, - 15, - 16, - 17, - 10, - 17, - 18, - 12, - 22, - 15, - 16, - 25, - 23, - 24, - 29, - 24, - 19, - 18, - 18, - 15, - 15, - 41, - 20, - 30, - 9, - 13, - 14, - 21, - 15, - 18, - 7, - 16, - 10, - 11, - 20, - 14, - 16, - 23, - 12, - 22, - 14, - 26, - 105, - 17, - 26, - 26, - 20, - 20, - 22, - 13, - 36, - 19, - 15, - 24, - 20, - 17, - 23, - 17, - 14, - 28, - 14, - 19, - 18, - 16, - 16, - 22, - 18, - 11, - 19, - 21, - 13, - 33, - 58, - 34, - 21, - 20, - 15, - 18, - 18, - 26, - 26, - 4, - 21, - 21, - 24, - 20, - 10, - 10, - 21, - 21, - 20, - 18, - 20, - 15, - 12, - 25, - 21, - 19, - 20, - 21, - 11, - 77, - 18, - 32, - 12, - 20, - 18, - 22, - 13, - 11, - 12, - 11, - 16, - 18, - 27, - 24, - 21, - 29, - 13, - 26, - 23, - 28, - 20, - 29, - 21, - 14, - 19, - 18, - 13, - 30, - 25, - 92, - 18, - 17, - 15, - 12, - 23, - 21, - 27, - 24, - 21, - 18, - 13, - 8, - 15, - 27, - 19, - 20, - 8, - 16, - 19, - 17, - 16, - 17, - 23, - 16, - 16, - 16, - 19, - 17, - 66, - 52, - 23, - 16, - 17, - 14, - 17, - 13, - 28, - 18, - 14, - 13, - 11, - 19, - 19, - 24, - 17, - 13, - 12, - 17, - 24, - 14, - 18, - 14, - 14, - 13, - 18, - 20, - 11, - 13, - 58, - 23, - 14, - 16, - 16, - 14, - 21, - 14, - 50, - 7, - 8, - 12, - 13, - 23, - 14, - 3, - 18, - 30, - 10, - 21, - 12, - 9, - 13, - 10, - 12, - 21, - 15, - 24, - 12, - 32, - 29, - 18, - 15, - 16, - 15, - 19, - 17, - 10, - 31, - 9, - 13, - 15, - 17, - 12, - 13, - 13, - 10, - 14, - 14, - 7, - 16, - 18, - 14, - 17, - 13, - 13, - 11, - 16, - 17, - 41, - 20, - 20, - 15, - 19, - 16, - 10, - 15, - 27, - 11, - 11, - 27, - 17, - 20, - 15, - 14, - 23, - 18, - 18, - 16, - 13, - 10, - 19, - 18, - 25, - 20, - 12, - 12, - 17, - 15, - 44, - 22, - 14, - 13, - 13, - 14, - 27, - 12, - 17, - 17, - 18, - 9, - 17, - 23, - 26, - 14, - 19, - 14, - 19, - 9, - 7, - 20, - 18, - 19, - 11, - 13, - 15, - 24, - 13, - 37, - 144, - 149, - 40, - 13, - 12, - 11, - 22, - 10, - 26, - 14, - 14, - 13, - 15, - 17, - 18, - 15, - 15, - 15, - 18, - 20, - 13, - 15, - 8, - 17, - 16, - 13, - 13, - 18, - 7, - 29, - 14, - 19, - 17, - 15, - 16, - 11, - 12, - 17, - 19, - 21, - 10, - 22, - 16, - 11, - 13, - 12, - 14, - 8, - 14, - 16, - 11, - 9, - 11, - 28, - 16, - 12, - 16, - 14, - 31, - 52, - 40, - 11, - 20, - 16, - 24, - 17, - 10, - 14, - 10, - 17, - 15, - 12, - 17, - 11, - 19, - 11, - 12, - 16, - 14, - 7, - 12, - 14, - 16, - 16, - 16, - 13, - 16, - 9, - 64, - 88, - 11, - 11, - 11, - 15, - 13, - 14, - 22, - 12, - 10, - 11, - 15, - 10, - 19, - 15, - 13, - 18, - 16, - 15, - 23, - 18, - 16, - 18, - 22, - 20, - 21, - 14, - 20, - 20, - 35, - 40, - 21, - 11, - 11, - 10, - 15, - 15, - 25, - 16, - 23, - 15, - 19, - 12, - 21, - 17, - 11, - 13, - 16, - 20, - 19, - 10, - 16, - 15, - 16, - 19, - 16, - 15, - 14, - 8, - 35, - 18, - 21, - 17, - 22, - 15, - 16, - 17, - 34, - 15, - 17, - 14, - 12, - 23, - 11, - 20, - 16, - 20, - 15, - 23, - 15, - 20, - 12, - 15, - 20, - 19, - 19, - 16, - 18, - 124, - 132, - 16, - 26, - 15, - 19, - 17, - 15, - 23, - 15, - 29, - 26, - 15, - 18, - 24, - 18, - 20, - 14, - 15, - 19, - 11, - 17, - 14, - 18, - 17, - 10, - 18, - 16, - 8, - 41, - 14, - 19, - 14, - 12, - 7, - 9, - 18, - 16, - 18, - 18, - 15, - 20, - 17, - 20, - 13, - 15, - 21, - 15, - 13, - 8, - 27, - 15, - 16, - 12, - 21, - 16, - 16, - 31, - 13, - 49, - 50, - 19, - 27, - 23, - 19, - 11, - 12, - 23, - 11, - 18, - 10, - 7, - 11, - 9, - 20, - 14, - 11, - 10, - 21, - 16, - 14, - 8, - 10, - 14, - 17, - 9, - 8, - 15, - 41, - 49, - 19, - 4, - 8, - 16, - 12, - 14, - 13, - 17, - 16, - 11, - 22, - 19, - 23, - 15, - 22, - 16, - 11, - 21, - 25, - 10, - 20, - 14, - 17, - 14, - 11, - 13, - 11, - 14, - 59, - 18, - 22, - 12, - 19, - 18, - 14, - 16, - 44, - 19, - 31, - 18, - 15, - 12, - 18, - 25, - 15, - 10, - 12, - 21, - 19, - 18, - 18, - 19, - 12, - 20, - 17, - 15, - 18, - 29, - 139, - 143, - 14, - 12, - 8, - 13, - 24, - 15, - 45, - 16, - 4, - 18, - 12, - 18, - 10, - 19, - 29, - 18, - 14, - 23, - 22, - 22, - 15, - 17, - 15, - 19, - 17, - 11, - 14, - 50, - 104, - 58, - 12, - 12, - 17, - 15, - 25, - 30, - 13, - 9, - 10, - 17, - 20, - 16, - 16, - 18, - 16, - 12, - 19, - 15, - 9, - 19, - 11, - 16, - 18, - 14, - 7, - 15, - 11, - 67, - 31, - 41, - 21, - 14, - 7, - 13, - 15, - 17, - 9, - 8, - 12, - 10, - 10, - 16, - 13, - 28, - 7, - 13, - 14, - 18, - 12, - 13, - 9, - 9, - 19, - 16, - 15, - 25, - 56, - 129, - 13, - 19, - 17, - 16, - 12, - 10, - 14, - 25, - 15, - 10, - 22, - 22, - 18, - 11, - 24, - 14, - 16, - 14, - 15, - 21, - 8, - 12, - 13, - 17, - 18, - 21, - 9, - 21, - 56, - 15, - 23, - 13, - 16, - 9, - 11, - 10, - 56, - 9, - 14, - 22, - 16, - 20, - 30, - 13, - 17, - 9, - 11, - 16, - 19, - 16, - 14, - 19, - 7, - 14, - 19, - 18, - 18, - 25, - 20, - 34, - 24, - 8, - 19, - 12, - 27, - 24, - 32, - 15, - 13, - 19, - 24, - 10, - 17, - 16, - 10, - 16, - 9, - 17, - 13, - 14, - 19, - 18, - 14, - 11, - 27, - 23, - 19, - 85, - 69, - 19, - 20, - 14, - 11, - 12, - 8, - 28, - 18, - 16, - 9, - 10, - 14, - 20, - 23, - 19, - 16, - 17, - 15, - 16, - 11, - 16, - 14, - 14, - 16, - 10, - 17, - 13, - 25, - 48, - 23, - 23, - 17, - 15, - 16, - 11, - 11, - 60, - 19, - 16, - 23, - 17, - 11, - 16, - 14, - 19, - 26, - 10, - 19, - 12, - 14, - 11, - 13, - 13, - 14, - 20, - 18, - 14, - 68, - 153, - 193, - 97, - 18, - 13, - 17, - 28, - 19, - 47, - 15, - 22, - 11, - 15, - 17, - 19, - 9, - 13, - 14, - 12, - 15, - 18, - 20, - 17, - 7, - 15, - 17, - 15, - 21, - 15, - 69, - 63, - 11, - 18, - 11, - 20, - 17, - 13, - 40, - 18, - 10, - 10, - 13, - 12, - 19, - 9, - 12, - 18, - 13, - 16, - 11, - 18, - 15, - 22, - 16, - 12, - 22, - 21, - 15, - 45, - 104, - 24, - 10, - 22, - 15, - 15, - 27, - 11, - 19, - 13, - 12, - 9, - 8, - 9, - 6, - 18, - 14, - 15, - 12, - 6, - 18, - 26, - 21, - 26, - 26, - 19, - 14, - 24, - 12, - 18, - 27, - 47, - 14, - 19, - 19, - 25, - 17, - 36, - 43, - 22, - 9, - 9, - 19, - 13, - 15, - 18, - 21, - 9, - 18, - 16, - 8, - 16, - 14, - 8, - 19, - 11, - 22, - 10, - 18, - 58, - 28, - 17, - 14, - 15, - 25, - 8, - 19, - 29, - 27, - 16, - 23, - 19, - 13, - 28, - 21, - 14, - 17, - 17, - 19, - 29, - 14, - 16, - 7, - 17, - 23, - 22, - 16, - 11, - 39, - 88, - 68, - 17, - 6, - 15, - 22, - 27, - 23, - 14, - 17, - 11, - 12, - 17, - 19, - 9, - 12, - 16, - 14, - 22, - 15, - 15, - 14, - 15, - 15, - 21, - 21, - 15, - 17, - 21, - 31, - 20, - 26, - 27, - 17, - 21, - 16, - 15, - 42, - 20, - 15, - 24, - 17, - 23, - 21, - 24, - 15, - 22, - 20, - 15, - 6, - 13, - 26, - 22, - 23, - 18, - 24, - 17, - 20, - 41, - 58, - 24, - 27, - 23, - 20, - 25, - 17, - 17, - 63, - 11, - 9, - 17, - 23, - 11, - 17, - 22, - 11, - 23, - 10, - 15, - 13, - 13, - 20, - 9, - 16, - 22, - 15, - 16, - 28, - 108, - 104, - 57, - 16, - 22, - 22, - 19, - 23, - 27, - 15, - 17, - 20, - 24, - 21, - 19, - 20, - 27, - 26, - 18, - 27, - 19, - 21, - 16, - 18, - 24, - 15, - 28, - 16, - 20, - 29, - 116, - 64, - 19, - 23, - 29, - 20, - 31, - 13, - 49, - 16, - 13, - 26, - 17, - 20, - 16, - 19, - 24, - 28, - 21, - 23, - 25, - 18, - 21, - 18, - 17, - 22, - 19, - 22, - 23, - 4, - 44, - 28, - 12, - 23, - 20, - 22, - 23, - 22, - 37, - 18, - 23, - 25, - 25, - 17, - 12, - 20, - 29, - 26, - 25, - 16, - 23, - 30, - 26, - 20, - 18, - 28, - 25, - 20, - 18, - 70, - 42, - 26, - 22, - 21, - 23, - 26, - 30, - 64, - 47, - 27, - 24, - 18, - 20, - 23, - 18, - 21, - 18, - 15, - 25, - 26, - 22, - 18, - 25, - 23, - 24, - 14, - 16, - 19, - 29, - 75, - 26, - 26, - 23, - 12, - 18, - 21, - 21, - 29, - 18, - 18, - 13, - 22, - 15, - 19, - 12, - 16, - 21, - 23, - 29, - 34, - 15, - 15, - 19, - 22, - 22, - 14, - 24, - 15, - 56, - 32, - 42, - 18, - 12, - 8, - 19, - 20, - 42, - 15, - 19, - 20, - 25, - 22, - 19, - 22, - 19, - 16, - 14, - 14, - 17, - 25, - 14, - 19, - 24, - 18, - 16, - 18, - 13, - 17, - 43, - 33, - 20, - 24, - 24, - 12, - 12, - 10, - 75, - 14, - 20, - 12, - 14, - 14, - 13, - 10, - 12, - 10, - 20, - 23, - 16, - 20, - 16, - 22, - 17, - 17, - 12, - 13, - 12, - 32, - 37, - 19, - 18, - 13, - 12, - 11, - 15, - 16, - 18, - 16, - 16, - 8, - 15, - 13, - 19, - 14, - 12, - 17, - 24, - 12, - 13, - 23, - 19, - 15, - 21, - 12, - 20, - 15, - 28, - 90, - 41, - 28, - 24, - 12, - 16, - 14, - 22, - 17, - 16, - 16, - 16, - 15, - 17, - 19, - 16, - 20, - 26, - 13, - 11, - 23, - 12, - 23, - 18, - 10, - 18, - 15, - 11, - 21, - 19, - 67, - 21, - 17, - 17, - 20, - 15, - 12, - 15, - 40, - 12, - 22, - 18, - 8, - 11, - 17, - 15, - 19, - 12, - 13, - 14, - 21, - 14, - 11, - 12, - 18, - 20, - 12, - 17, - 20, - 36, - 88, - 34, - 16, - 12, - 13, - 14, - 14, - 20, - 22, - 11, - 10, - 10, - 13, - 18, - 20, - 17, - 9, - 15, - 21, - 17, - 17, - 19, - 14, - 14, - 28, - 18, - 18, - 14, - 12, - 34, - 27, - 13, - 17, - 20, - 14, - 16, - 24, - 39, - 16, - 14, - 14, - 16, - 28, - 15, - 24, - 19, - 17, - 14, - 20, - 20, - 13, - 23, - 19, - 16, - 19, - 21, - 14, - 11, - 37, - 35, - 15, - 9, - 23, - 15, - 12, - 14, - 15, - 14, - 19, - 18, - 12, - 10, - 15, - 16, - 19, - 19, - 11, - 20, - 21, - 16, - 16, - 12, - 16, - 13, - 15, - 14, - 17, - 14, - 41, - 40, - 15, - 15, - 14, - 21, - 19, - 18, - 31, - 18, - 17, - 18, - 16, - 17, - 12, - 14, - 11, - 22, - 15, - 18, - 20, - 14, - 18, - 15, - 20, - 19, - 20, - 18, - 20, - 26, - 35, - 50, - 22, - 16, - 19, - 12, - 13, - 15, - 29, - 24, - 18, - 13, - 17, - 11, - 16, - 21, - 29, - 22, - 12, - 16, - 12, - 12, - 13, - 16, - 25, - 16, - 13, - 10, - 10, - 39, - 99, - 26, - 21, - 14, - 19, - 13, - 13, - 37, - 17, - 14, - 14, - 16, - 21, - 13, - 6, - 12, - 13, - 9, - 9, - 14, - 14, - 11, - 15, - 15, - 8, - 19, - 11, - 11, - 17, - 134, - 84, - 46, - 9, - 15, - 20, - 14, - 12, - 13, - 13, - 15, - 19, - 13, - 12, - 17, - 14, - 13, - 15, - 14, - 21, - 21, - 21, - 20, - 17, - 13, - 18, - 17, - 19, - 26, - 52, - 40, - 14, - 27, - 10, - 16, - 21, - 17, - 13, - 14, - 11, - 13, - 14, - 13, - 13, - 10, - 15, - 9, - 15, - 16, - 23, - 15, - 16, - 15, - 22, - 21, - 20, - 13, - 28, - 17, - 25, - 12, - 18, - 22, - 15, - 16, - 13, - 14, - 32, - 6, - 15, - 13, - 15, - 12, - 15, - 19, - 20, - 14, - 18, - 11, - 16, - 16, - 19, - 10, - 17, - 22, - 14, - 10, - 7, - 21, - 28, - 23, - 19, - 9, - 16, - 19, - 11, - 18, - 23, - 8, - 18, - 14, - 9, - 13, - 17, - 18, - 16, - 8, - 26, - 19, - 11, - 8, - 10, - 9, - 7, - 20, - 13, - 11, - 19, - 38, - 31, - 31, - 39, - 40, - 29, - 9, - 10, - 24, - 15, - 9, - 13, - 21, - 13, - 19, - 12, - 11, - 9, - 17, - 15, - 13, - 12, - 16, - 15, - 13, - 16, - 15, - 18, - 15, - 18, - 37, - 27, - 6, - 13, - 8, - 14, - 13, - 17, - 67, - 17, - 16, - 16, - 16, - 19, - 10, - 14, - 10, - 15, - 14, - 10, - 15, - 14, - 14, - 16, - 11, - 9, - 17, - 16, - 13, - 43, - 22, - 19, - 12, - 16, - 15, - 16, - 8, - 13, - 25, - 14, - 14, - 29, - 12, - 20, - 11, - 12, - 9, - 16, - 13, - 10, - 14, - 18, - 30, - 17, - 11, - 18, - 12, - 10, - 16, - 42, - 17, - 32, - 15, - 20, - 13, - 14, - 16, - 42, - 16, - 16, - 21, - 14, - 16, - 11, - 15, - 14, - 18, - 20, - 10, - 15, - 4, - 16, - 13, - 15, - 15, - 12, - 28, - 14, - 62, - 165, - 84, - 12, - 16, - 7, - 18, - 13, - 15, - 29, - 11, - 18, - 18, - 9, - 12, - 11, - 12, - 16, - 11, - 17, - 19, - 14, - 10, - 13, - 14, - 16, - 15, - 11, - 16, - 18, - 24, - 23, - 11, - 14, - 9, - 11, - 13, - 9, - 34, - 14, - 11, - 9, - 11, - 12, - 12, - 15, - 12, - 26, - 9, - 17, - 10, - 16, - 13, - 8, - 11, - 17, - 7, - 6, - 11, - 24, - 69, - 19, - 16, - 10, - 12, - 12, - 9, - 14, - 11, - 13, - 13, - 17, - 7, - 12, - 19, - 16, - 10, - 5, - 16, - 13, - 10, - 8, - 11, - 11, - 14, - 16, - 8, - 14, - 8, - 44, - 51, - 16, - 7, - 14, - 15, - 21, - 10, - 20, - 30, - 8, - 14, - 18, - 15, - 29, - 17, - 11, - 8, - 11, - 11, - 15, - 14, - 14, - 16, - 11, - 18, - 12, - 8, - 11, - 11, - 12, - 15, - 26, - 22, - 14, - 6, - 14, - 6, - 31, - 7, - 15, - 14, - 11, - 6, - 12, - 15, - 16, - 14, - 17, - 21, - 6, - 12, - 14, - 12, - 10, - 10, - 16, - 13, - 13, - 11, - 62, - 13, - 11, - 15, - 12, - 14, - 9, - 13, - 18, - 17, - 13, - 12, - 9, - 10, - 9, - 18, - 10, - 12, - 10, - 15, - 12, - 15, - 14, - 20, - 14, - 9, - 8, - 7, - 14, - 42, - 40, - 25, - 8, - 11, - 14, - 22, - 12, - 19, - 22, - 11, - 17, - 15, - 12, - 4, - 10, - 11, - 8, - 18, - 10, - 12, - 10, - 16, - 11, - 17, - 15, - 7, - 8, - 18, - 9, - 57, - 13, - 25, - 17, - 13, - 12, - 13, - 11, - 20, - 12, - 14, - 10, - 11, - 9, - 12, - 11, - 16, - 14, - 9, - 12, - 23, - 10, - 14, - 6, - 16, - 20, - 8, - 19, - 12, - 31, - 69, - 26, - 15, - 7, - 12, - 20, - 14, - 14, - 16, - 13, - 12, - 14, - 8, - 9, - 8, - 14, - 10, - 11, - 12, - 14, - 4, - 14, - 15, - 11, - 12, - 14, - 11, - 14, - 9, - 47, - 125, - 21, - 14, - 5, - 15, - 14, - 7, - 20, - 16, - 15, - 12, - 10, - 8, - 18, - 13, - 13, - 18, - 8, - 11, - 19, - 10, - 11, - 20, - 12, - 13, - 5, - 21, - 10, - 7, - 20, - 17, - 14, - 11, - 15, - 24, - 10, - 10, - 61, - 12, - 14, - 15, - 15, - 10, - 11, - 17, - 13, - 14, - 14, - 11, - 19, - 12, - 17, - 14, - 14, - 27, - 18, - 11, - 13, - 32, - 50, - 12, - 8, - 14, - 7, - 10, - 16, - 10, - 23, - 23, - 14, - 15, - 18, - 15, - 14, - 16, - 23, - 9, - 6, - 8, - 8, - 14, - 8, - 16, - 10, - 8, - 17, - 10, - 19, - 18, - 14, - 12, - 8, - 10, - 12, - 20, - 9, - 12, - 8, - 26, - 16, - 5, - 16, - 17, - 8, - 15, - 8, - 15, - 11, - 14, - 11, - 16, - 14, - 7, - 12, - 11, - 10, - 11, - 23, - 45, - 61, - 41, - 11, - 14, - 20, - 17, - 13, - 18, - 20, - 13, - 19, - 9, - 18, - 9, - 13, - 16, - 16, - 15, - 14, - 13, - 11, - 9, - 11, - 16, - 13, - 13, - 18, - 9, - 49, - 15, - 12, - 18, - 15, - 9, - 8, - 8, - 19, - 18, - 16, - 16, - 6, - 17, - 14, - 20, - 8, - 15, - 16, - 8, - 17, - 8, - 10, - 16, - 15, - 18, - 24, - 18, - 11, - 18, - 90, - 94, - 126, - 65, - 12, - 11, - 16, - 24, - 38, - 14, - 13, - 17, - 15, - 13, - 16, - 12, - 13, - 11, - 10, - 22, - 12, - 14, - 9, - 9, - 8, - 15, - 17, - 10, - 13, - 54, - 90, - 135, - 115, - 13, - 16, - 13, - 8, - 16, - 15, - 16, - 10, - 12, - 20, - 10, - 9, - 21, - 26, - 22, - 10, - 12, - 12, - 21, - 14, - 21, - 8, - 15, - 17, - 16, - 11, - 37, - 12, - 25, - 10, - 12, - 10, - 12, - 20, - 30, - 16, - 12, - 9, - 10, - 14, - 14, - 7, - 6, - 13, - 10, - 15, - 9, - 12, - 12, - 17, - 17, - 8, - 19, - 7, - 10, - 16, - 28, - 17, - 15, - 8, - 23, - 10, - 13, - 17, - 13, - 9, - 15, - 12, - 15, - 9, - 17, - 15, - 12, - 16, - 10, - 14, - 21, - 13, - 7, - 10, - 10, - 14, - 11, - 17, - 14, - 77, - 109, - 72, - 10, - 18, - 12, - 12, - 12, - 28, - 57, - 26, - 18, - 19, - 35, - 15, - 17, - 17, - 13, - 11, - 21, - 16, - 17, - 16, - 16, - 18, - 7, - 13, - 12, - 10, - 16, - 20, - 17, - 19, - 10, - 17, - 5, - 12, - 26, - 22, - 14, - 12, - 13, - 11, - 11, - 10, - 11, - 11, - 11, - 16, - 11, - 8, - 11, - 19, - 18, - 12, - 10, - 14, - 7, - 11, - 32, - 44, - 34, - 8, - 16, - 17, - 12, - 16, - 17, - 67, - 21, - 20, - 12, - 24, - 7, - 10, - 15, - 11, - 17, - 12, - 12, - 18, - 21, - 12, - 11, - 8, - 13, - 18, - 9, - 8, - 34, - 11, - 17, - 16, - 8, - 8, - 16, - 12, - 21, - 9, - 20, - 10, - 13, - 12, - 15, - 11, - 9, - 15, - 10, - 25, - 10, - 15, - 14, - 18, - 16, - 12, - 11, - 13, - 11, - 20, - 16, - 16, - 23, - 9, - 21, - 12, - 18, - 18, - 15, - 15, - 4, - 15, - 13, - 14, - 12, - 20, - 11, - 18, - 17, - 13, - 9, - 11, - 13, - 24, - 20, - 16, - 15, - 17, - 25, - 72, - 104, - 167, - 175, - 10, - 12, - 18, - 8, - 23, - 17, - 11, - 12, - 14, - 15, - 12, - 10, - 14, - 18, - 13, - 19, - 21, - 24, - 22, - 12, - 15, - 15, - 12, - 16, - 12, - 10, - 34, - 16, - 20, - 17, - 10, - 11, - 15, - 12, - 51, - 28, - 16, - 18, - 7, - 3, - 13, - 14, - 18, - 15, - 8, - 13, - 10, - 12, - 14, - 10, - 13, - 11, - 15, - 13, - 20, - 22, - 44, - 24, - 15, - 11, - 11, - 12, - 21, - 14, - 25, - 17, - 14, - 13, - 18, - 10, - 25, - 22, - 13, - 10, - 19, - 9, - 18, - 11, - 20, - 22, - 20, - 24, - 15, - 15, - 10, - 46, - 43, - 24, - 15, - 14, - 11, - 24, - 14, - 15, - 16, - 12, - 26, - 12, - 14, - 16, - 15, - 20, - 13, - 17, - 17, - 11, - 16, - 11, - 15, - 20, - 22, - 13, - 10, - 14, - 11, - 26, - 10, - 5, - 9, - 6, - 17, - 8, - 21, - 26, - 18, - 11, - 14, - 12, - 13, - 10, - 19, - 9, - 11, - 13, - 17, - 23, - 14, - 12, - 16, - 17, - 13, - 21, - 14, - 28, - 50, - 147, - 42, - 36, - 18, - 11, - 14, - 19, - 25, - 65, - 18, - 12, - 16, - 17, - 12, - 10, - 16, - 6, - 19, - 17, - 20, - 8, - 12, - 12, - 19, - 26, - 13, - 10, - 11, - 12, - 22, - 23, - 9, - 9, - 13, - 13, - 13, - 12, - 31, - 12, - 13, - 14, - 14, - 11, - 13, - 12, - 16, - 5, - 8, - 19, - 17, - 17, - 17, - 12, - 30, - 19, - 10, - 17, - 24, - 40, - 32, - 17, - 12, - 15, - 10, - 15, - 12, - 16, - 31, - 22, - 16, - 16, - 8, - 8, - 17, - 11, - 15, - 10, - 9, - 10, - 17, - 17, - 18, - 14, - 13, - 17, - 16, - 15, - 10, - 92, - 148, - 20, - 13, - 10, - 12, - 12, - 12, - 12, - 26, - 13, - 18, - 20, - 11, - 16, - 9, - 7, - 19, - 20, - 15, - 8, - 12, - 22, - 14, - 27, - 16, - 18, - 10, - 14, - 22, - 24, - 26, - 11, - 10, - 14, - 14, - 21, - 12, - 62, - 62, - 16, - 13, - 14, - 14, - 16, - 12, - 5, - 16, - 12, - 21, - 16, - 19, - 17, - 13, - 12, - 9, - 15, - 18, - 10, - 65, - 32, - 10, - 22, - 11, - 21, - 22, - 17, - 29, - 18, - 13, - 9, - 12, - 17, - 20, - 9, - 13, - 24, - 10, - 16, - 19, - 13, - 19, - 13, - 21, - 14, - 14, - 14, - 13, - 20, - 48, - 31, - 12, - 10, - 13, - 8, - 16, - 16, - 32, - 8, - 5, - 17, - 11, - 11, - 11, - 19, - 11, - 13, - 16, - 18, - 13, - 15, - 11, - 17, - 13, - 19, - 13, - 13, - 4, - 22, - 23, - 20, - 13, - 15, - 15, - 15, - 16, - 11, - 18, - 15, - 9, - 16, - 10, - 16, - 7, - 15, - 10, - 11, - 14, - 16, - 11, - 16, - 12, - 11, - 8, - 16, - 12, - 12, - 13, - 49, - 136, - 92, - 82, - 15, - 12, - 11, - 16, - 15, - 14, - 17, - 11, - 15, - 14, - 17, - 13, - 17, - 17, - 13, - 13, - 15, - 19, - 13, - 15, - 28, - 13, - 10, - 22, - 8, - 17, - 30, - 17, - 8, - 10, - 9, - 15, - 12, - 5, - 23, - 9, - 16, - 16, - 9, - 9, - 9, - 8, - 14, - 11, - 10, - 12, - 9, - 8, - 15, - 14, - 19, - 12, - 14, - 21, - 13, - 43, - 35, - 16, - 11, - 18, - 13, - 17, - 9, - 11, - 11, - 15, - 19, - 16, - 10, - 10, - 15, - 13, - 11, - 12, - 22, - 12, - 22, - 21, - 16, - 9, - 18, - 14, - 27, - 14, - 20, - 82, - 155, - 118, - 15, - 11, - 12, - 7, - 9, - 22, - 13, - 6, - 13, - 19, - 10, - 16, - 19, - 13, - 13, - 9, - 17, - 17, - 17, - 19, - 27, - 20, - 14, - 21, - 10, - 17, - 14, - 59, - 11, - 19, - 20, - 17, - 12, - 18, - 11, - 16, - 15, - 21, - 23, - 16, - 13, - 16, - 11, - 10, - 16, - 11, - 16, - 9, - 13, - 11, - 11, - 14, - 13, - 14, - 11, - 8, - 50, - 24, - 65, - 12, - 12, - 21, - 15, - 10, - 14, - 13, - 20, - 9, - 9, - 15, - 15, - 15, - 14, - 12, - 15, - 23, - 9, - 21, - 18, - 10, - 19, - 13, - 21, - 16, - 14, - 15, - 25, - 10, - 25, - 12, - 20, - 16, - 18, - 18, - 35, - 18, - 15, - 19, - 14, - 6, - 16, - 25, - 13, - 14, - 13, - 13, - 26, - 11, - 17, - 17, - 21, - 10, - 16, - 14, - 10, - 24, - 25, - 21, - 26, - 17, - 18, - 10, - 7, - 16, - 35, - 16, - 12, - 11, - 11, - 17, - 13, - 6, - 16, - 12, - 16, - 17, - 11, - 11, - 11, - 11, - 19, - 12, - 16, - 10, - 11, - 22, - 94, - 59, - 18, - 15, - 15, - 18, - 15, - 18, - 18, - 15, - 7, - 11, - 17, - 13, - 11, - 9, - 11, - 13, - 20, - 11, - 15, - 9, - 16, - 16, - 7, - 18, - 9, - 10, - 14, - 12, - 32, - 9, - 15, - 9, - 16, - 28, - 15, - 32, - 14, - 18, - 18, - 16, - 20, - 8, - 23, - 23, - 19, - 12, - 15, - 16, - 14, - 21, - 19, - 16, - 16, - 13, - 7, - 17, - 50, - 48, - 16, - 16, - 12, - 22, - 19, - 21, - 8, - 22, - 16, - 11, - 12, - 17, - 18, - 13, - 11, - 14, - 27, - 24, - 25, - 16, - 12, - 8, - 11, - 22, - 21, - 15, - 22, - 29, - 75, - 36, - 59, - 18, - 25, - 20, - 16, - 13, - 48, - 24, - 22, - 23, - 18, - 10, - 18, - 18, - 11, - 14, - 18, - 11, - 13, - 15, - 25, - 15, - 15, - 26, - 24, - 21, - 30, - 53, - 47, - 26, - 16, - 20, - 18, - 13, - 14, - 14, - 25, - 12, - 13, - 15, - 16, - 13, - 26, - 16, - 16, - 15, - 19, - 14, - 18, - 15, - 22, - 15, - 23, - 10, - 15, - 8, - 16, - 5, - 58, - 27, - 17, - 18, - 20, - 24, - 24, - 40, - 21, - 25, - 12, - 18, - 22, - 17, - 22, - 24, - 15, - 10, - 15, - 22, - 19, - 22, - 20, - 15, - 22, - 17, - 16, - 23, - 29, - 82, - 37, - 27, - 18, - 17, - 23, - 25, - 12, - 26, - 18, - 25, - 20, - 12, - 12, - 12, - 27, - 13, - 22, - 20, - 21, - 16, - 27, - 23, - 19, - 15, - 12, - 23, - 20, - 8, - 64, - 60, - 33, - 17, - 19, - 23, - 17, - 12, - 23, - 29, - 21, - 17, - 12, - 18, - 17, - 11, - 16, - 24, - 20, - 25, - 21, - 19, - 18, - 15, - 31, - 18, - 24, - 21, - 16, - 26, - 20, - 23, - 43, - 18, - 16, - 11, - 19, - 17, - 38, - 10, - 9, - 25, - 15, - 16, - 17, - 18, - 19, - 18, - 13, - 14, - 19, - 20, - 22, - 8, - 27, - 27, - 12, - 18, - 21, - 26, - 22, - 30, - 21, - 23, - 16, - 21, - 16, - 13, - 20, - 24, - 11, - 16, - 17, - 18, - 19, - 18, - 16, - 26, - 16, - 14, - 17, - 23, - 22, - 16, - 17, - 24, - 18, - 10, - 18, - 43, - 25, - 12, - 19, - 15, - 14, - 15, - 16, - 26, - 26, - 13, - 13, - 21, - 17, - 27, - 21, - 13, - 11, - 16, - 13, - 13, - 17, - 19, - 10, - 18, - 24, - 17, - 19, - 18, - 19, - 102, - 106, - 12, - 13, - 10, - 14, - 12, - 19, - 49, - 25, - 17, - 18, - 12, - 30, - 9, - 18, - 9, - 14, - 19, - 24, - 17, - 16, - 16, - 18, - 17, - 20, - 20, - 22, - 19, - 38, - 38, - 18, - 16, - 14, - 7, - 19, - 9, - 24, - 25, - 13, - 10, - 19, - 27, - 14, - 16, - 12, - 10, - 16, - 15, - 16, - 15, - 11, - 13, - 23, - 20, - 10, - 20, - 15, - 16, - 119, - 64, - 21, - 16, - 18, - 18, - 14, - 14, - 35, - 17, - 16, - 14, - 13, - 15, - 16, - 16, - 14, - 18, - 20, - 23, - 15, - 19, - 17, - 20, - 18, - 22, - 18, - 13, - 19, - 39, - 44, - 22, - 28, - 17, - 19, - 19, - 6, - 13, - 22, - 15, - 13, - 18, - 21, - 25, - 14, - 20, - 21, - 13, - 18, - 20, - 19, - 14, - 18, - 20, - 12, - 14, - 18, - 11, - 18, - 28, - 24, - 22, - 17, - 19, - 9, - 15, - 18, - 37, - 13, - 13, - 11, - 20, - 9, - 8, - 12, - 11, - 8, - 8, - 12, - 24, - 16, - 9, - 15, - 11, - 14, - 13, - 18, - 22, - 31, - 27, - 33, - 15, - 15, - 17, - 10, - 16, - 18, - 21, - 15, - 14, - 16, - 18, - 12, - 14, - 15, - 9, - 19, - 8, - 11, - 18, - 15, - 11, - 20, - 12, - 29, - 13, - 14, - 15, - 32, - 18, - 16, - 16, - 14, - 13, - 7, - 14, - 18, - 13, - 10, - 13, - 18, - 9, - 16, - 19, - 11, - 9, - 15, - 18, - 12, - 11, - 14, - 19, - 13, - 10, - 14, - 20, - 16, - 20, - 62, - 13, - 16, - 12, - 18, - 16, - 18, - 12, - 15, - 11, - 11, - 19, - 15, - 20, - 13, - 9, - 11, - 15, - 13, - 10, - 15, - 11, - 12, - 7, - 15, - 15, - 21, - 21, - 18, - 57, - 131, - 14, - 11, - 15, - 12, - 11, - 13, - 20, - 19, - 6, - 16, - 9, - 14, - 13, - 16, - 22, - 11, - 10, - 12, - 23, - 21, - 22, - 22, - 10, - 9, - 15, - 13, - 15, - 14, - 25, - 30, - 26, - 18, - 19, - 23, - 24, - 15, - 37, - 49, - 16, - 11, - 12, - 9, - 16, - 7, - 15, - 12, - 9, - 11, - 9, - 20, - 10, - 14, - 10, - 15, - 15, - 8, - 11, - 18, - 58, - 12, - 14, - 9, - 12, - 12, - 11, - 13, - 15, - 15, - 18, - 9, - 15, - 24, - 10, - 11, - 9, - 14, - 7, - 20, - 19, - 13, - 16, - 16, - 17, - 15, - 20, - 17, - 15, - 31, - 47, - 23, - 14, - 12, - 21, - 17, - 18, - 12, - 15, - 17, - 24, - 17, - 13, - 16, - 21, - 14, - 16, - 12, - 19, - 14, - 15, - 9, - 10, - 16, - 15, - 14, - 11, - 10, - 14, - 53, - 91, - 82, - 16, - 13, - 11, - 14, - 9, - 22, - 10, - 15, - 13, - 18, - 6, - 10, - 7, - 19, - 18, - 15, - 11, - 9, - 19, - 5, - 11, - 15, - 21, - 24, - 12, - 10, - 31, - 81, - 21, - 12, - 12, - 24, - 12, - 11, - 9, - 10, - 16, - 9, - 12, - 17, - 16, - 15, - 15, - 18, - 7, - 21, - 10, - 18, - 18, - 19, - 10, - 10, - 13, - 15, - 10, - 10, - 63, - 66, - 25, - 13, - 16, - 7, - 15, - 15, - 27, - 14, - 14, - 10, - 15, - 15, - 16, - 9, - 15, - 9, - 19, - 12, - 14, - 9, - 18, - 17, - 17, - 18, - 11, - 18, - 14, - 16, - 36, - 15, - 13, - 13, - 12, - 13, - 12, - 11, - 31, - 14, - 9, - 13, - 19, - 12, - 22, - 12, - 12, - 12, - 15, - 17, - 8, - 17, - 13, - 18, - 7, - 12, - 15, - 14, - 14, - 54, - 51, - 54, - 15, - 9, - 19, - 12, - 13, - 17, - 13, - 14, - 13, - 17, - 18, - 15, - 12, - 9, - 11, - 15, - 17, - 13, - 8, - 11, - 19, - 24, - 22, - 14, - 14, - 13, - 17, - 21, - 12, - 15, - 15, - 10, - 15, - 10, - 11, - 17, - 11, - 19, - 19, - 13, - 16, - 21, - 12, - 8, - 9, - 11, - 9, - 23, - 21, - 21, - 11, - 12, - 13, - 20, - 10, - 17, - 9, - 30, - 35, - 35, - 15, - 22, - 13, - 15, - 26, - 47, - 11, - 14, - 21, - 10, - 10, - 14, - 5, - 15, - 13, - 15, - 12, - 9, - 13, - 17, - 20, - 12, - 14, - 9, - 17, - 11, - 74, - 51, - 10, - 6, - 10, - 19, - 16, - 19, - 19, - 17, - 11, - 17, - 13, - 16, - 18, - 13, - 10, - 10, - 18, - 12, - 10, - 9, - 16, - 17, - 12, - 13, - 16, - 12, - 14, - 16, - 108, - 26, - 22, - 24, - 6, - 10, - 16, - 20, - 33, - 10, - 14, - 13, - 14, - 15, - 13, - 20, - 11, - 8, - 12, - 14, - 8, - 12, - 13, - 13, - 10, - 12, - 10, - 15, - 14, - 33, - 81, - 31, - 15, - 12, - 10, - 12, - 15, - 18, - 68, - 34, - 8, - 13, - 9, - 15, - 13, - 14, - 7, - 12, - 14, - 9, - 9, - 14, - 15, - 20, - 12, - 9, - 11, - 13, - 10, - 53, - 19, - 30, - 12, - 15, - 12, - 25, - 14, - 17, - 14, - 15, - 14, - 14, - 12, - 13, - 13, - 8, - 17, - 20, - 7, - 14, - 25, - 13, - 12, - 16, - 17, - 19, - 9, - 12, - 24, - 29, - 22, - 6, - 12, - 16, - 15, - 10, - 7, - 22, - 15, - 15, - 10, - 10, - 9, - 9, - 20, - 12, - 7, - 11, - 12, - 14, - 22, - 16, - 21, - 20, - 16, - 18, - 21, - 20, - 35, - 116, - 37, - 28, - 19, - 9, - 12, - 15, - 12, - 26, - 20, - 15, - 11, - 12, - 18, - 13, - 19, - 24, - 14, - 22, - 16, - 11, - 25, - 23, - 19, - 8, - 16, - 15, - 21, - 21, - 33, - 16, - 19, - 17, - 12, - 15, - 16, - 14, - 37, - 15, - 17, - 22, - 18, - 13, - 19, - 14, - 14, - 19, - 17, - 19, - 11, - 7, - 20, - 16, - 17, - 16, - 20, - 15, - 16, - 42, - 35, - 20, - 30, - 17, - 17, - 16, - 18, - 18, - 19, - 15, - 16, - 22, - 9, - 16, - 13, - 8, - 14, - 20, - 10, - 20, - 19, - 20, - 13, - 10, - 16, - 9, - 10, - 25, - 17, - 31, - 16, - 20, - 24, - 5, - 13, - 17, - 9, - 34, - 12, - 9, - 19, - 23, - 19, - 10, - 17, - 12, - 15, - 11, - 16, - 16, - 20, - 14, - 18, - 17, - 17, - 13, - 17, - 10, - 27, - 47, - 24, - 23, - 22, - 22, - 23, - 16, - 17, - 17, - 18, - 18, - 15, - 18, - 13, - 20, - 18, - 10, - 8, - 18, - 15, - 14, - 19, - 13, - 14, - 31, - 17, - 8, - 9, - 15, - 65, - 19, - 20, - 17, - 17, - 24, - 13, - 14, - 25, - 7, - 21, - 11, - 18, - 12, - 17, - 8, - 19, - 10, - 11, - 13, - 17, - 8, - 25, - 12, - 23, - 10, - 11, - 17, - 7, - 19, - 70, - 15, - 23, - 7, - 10, - 14, - 13, - 14, - 19, - 11, - 10, - 19, - 16, - 17, - 13, - 15, - 15, - 14, - 15, - 13, - 16, - 19, - 15, - 15, - 11, - 19, - 14, - 15, - 16, - 26, - 18, - 12, - 12, - 10, - 9, - 8, - 15, - 10, - 17, - 16, - 19, - 13, - 15, - 15, - 16, - 19, - 13, - 16, - 15, - 12, - 14, - 9, - 6, - 11, - 12, - 16, - 11, - 13, - 7, - 21, - 31, - 16, - 10, - 8, - 17, - 14, - 12, - 12, - 13, - 14, - 23, - 11, - 13, - 19, - 12, - 21, - 10, - 11, - 20, - 16, - 21, - 19, - 15, - 7, - 20, - 16, - 21, - 16, - 10, - 36, - 15, - 17, - 14, - 14, - 9, - 18, - 11, - 23, - 15, - 16, - 11, - 11, - 10, - 13, - 11, - 14, - 4, - 16, - 16, - 16, - 7, - 20, - 13, - 16, - 15, - 13, - 15, - 18, - 61, - 32, - 48, - 16, - 16, - 8, - 15, - 17, - 15, - 12, - 10, - 14, - 15, - 13, - 15, - 16, - 12, - 12, - 11, - 16, - 16, - 9, - 20, - 16, - 21, - 14, - 18, - 17, - 13, - 12, - 88, - 98, - 18, - 13, - 10, - 14, - 11, - 8, - 25, - 14, - 10, - 16, - 9, - 18, - 18, - 18, - 13, - 29, - 11, - 12, - 10, - 13, - 11, - 7, - 12, - 25, - 16, - 18, - 10, - 15, - 30, - 17, - 14, - 23, - 16, - 19, - 12, - 6, - 44, - 22, - 7, - 10, - 17, - 10, - 15, - 9, - 13, - 15, - 11, - 11, - 9, - 9, - 16, - 16, - 14, - 24, - 14, - 13, - 21, - 27, - 120, - 30, - 11, - 9, - 25, - 16, - 18, - 16, - 13, - 12, - 10, - 15, - 21, - 11, - 13, - 12, - 14, - 12, - 12, - 20, - 14, - 22, - 15, - 20, - 14, - 22, - 13, - 15, - 7, - 40, - 21, - 16, - 23, - 27, - 22, - 10, - 16, - 16, - 19, - 14, - 20, - 13, - 15, - 25, - 15, - 18, - 13, - 17, - 14, - 18, - 16, - 20, - 14, - 16, - 20, - 16, - 13, - 15, - 24, - 46, - 17, - 15, - 17, - 10, - 16, - 19, - 24, - 67, - 14, - 4, - 14, - 19, - 15, - 14, - 16, - 10, - 12, - 12, - 15, - 13, - 16, - 12, - 10, - 16, - 21, - 13, - 18, - 20, - 86, - 28, - 53, - 12, - 17, - 15, - 15, - 10, - 23, - 14, - 15, - 19, - 25, - 12, - 10, - 15, - 11, - 13, - 14, - 20, - 19, - 15, - 16, - 10, - 15, - 17, - 21, - 19, - 15, - 20, - 39, - 20, - 18, - 16, - 13, - 17, - 12, - 26, - 23, - 20, - 10, - 25, - 18, - 14, - 16, - 12, - 18, - 15, - 12, - 14, - 18, - 9, - 27, - 16, - 18, - 14, - 15, - 17, - 12, - 51, - 94, - 24, - 14, - 14, - 21, - 18, - 14, - 26, - 18, - 18, - 23, - 19, - 16, - 15, - 20, - 11, - 16, - 19, - 25, - 14, - 20, - 11, - 5, - 15, - 15, - 20, - 13, - 21, - 11, - 43, - 34, - 21, - 14, - 9, - 11, - 14, - 24, - 16, - 19, - 28, - 25, - 26, - 15, - 16, - 17, - 9, - 24, - 17, - 19, - 15, - 12, - 14, - 23, - 9, - 15, - 19, - 18, - 23, - 38, - 40, - 27, - 13, - 18, - 12, - 16, - 12, - 18, - 44, - 27, - 10, - 14, - 19, - 8, - 14, - 14, - 15, - 18, - 16, - 17, - 12, - 20, - 18, - 15, - 15, - 15, - 16, - 20, - 18, - 34, - 32, - 69, - 17, - 12, - 19, - 20, - 5, - 22, - 14, - 29, - 20, - 14, - 14, - 17, - 17, - 13, - 11, - 17, - 12, - 12, - 11, - 17, - 13, - 9, - 14, - 17, - 15, - 22, - 13, - 26, - 18, - 21, - 16, - 14, - 7, - 9, - 10, - 28, - 16, - 13, - 14, - 16, - 33, - 6, - 15, - 14, - 16, - 16, - 20, - 16, - 18, - 16, - 10, - 13, - 18, - 14, - 18, - 23, - 49, - 147, - 39, - 14, - 11, - 11, - 22, - 15, - 16, - 35, - 21, - 13, - 14, - 12, - 11, - 5, - 14, - 12, - 17, - 10, - 19, - 18, - 13, - 17, - 11, - 14, - 15, - 12, - 16, - 19, - 58, - 64, - 42, - 16, - 19, - 19, - 14, - 12, - 31, - 12, - 17, - 19, - 13, - 16, - 15, - 18, - 14, - 10, - 11, - 21, - 17, - 12, - 18, - 11, - 6, - 14, - 12, - 30, - 16, - 82, - 18, - 19, - 16, - 13, - 15, - 16, - 17, - 12, - 14, - 18, - 19, - 18, - 10, - 19, - 11, - 14, - 11, - 18, - 12, - 18, - 10, - 10, - 18, - 19, - 17, - 20, - 8, - 21, - 21, - 32, - 22, - 14, - 21, - 10, - 17, - 10, - 13, - 17, - 14, - 15, - 7, - 13, - 12, - 17, - 20, - 12, - 8, - 12, - 13, - 14, - 10, - 13, - 19, - 17, - 10, - 10, - 22, - 13, - 25, - 79, - 21, - 12, - 20, - 17, - 18, - 9, - 12, - 26, - 18, - 24, - 19, - 29, - 12, - 16, - 9, - 19, - 13, - 12, - 11, - 11, - 9, - 12, - 18, - 11, - 19, - 7, - 17, - 15, - 43, - 22, - 14, - 20, - 10, - 12, - 16, - 10, - 15, - 9, - 21, - 16, - 16, - 13, - 18, - 20, - 19, - 15, - 15, - 12, - 8, - 20, - 10, - 12, - 12, - 12, - 10, - 18, - 13, - 20, - 85, - 51, - 35, - 12, - 12, - 16, - 12, - 12, - 28, - 14, - 18, - 15, - 9, - 14, - 18, - 13, - 11, - 15, - 22, - 10, - 13, - 24, - 9, - 15, - 18, - 21, - 20, - 14, - 18, - 30, - 24, - 23, - 18, - 20, - 18, - 11, - 13, - 14, - 11, - 15, - 10, - 19, - 10, - 13, - 17, - 15, - 17, - 14, - 11, - 15, - 9, - 18, - 19, - 22, - 21, - 11, - 14, - 13, - 12, - 24, - 19, - 19, - 8, - 18, - 17, - 21, - 9, - 19, - 9, - 10, - 14, - 16, - 20, - 8, - 19, - 10, - 15, - 18, - 14, - 14, - 11, - 12, - 15, - 9, - 11, - 14, - 19, - 13, - 22, - 121, - 107, - 15, - 17, - 12, - 12, - 13, - 11, - 12, - 12, - 16, - 14, - 9, - 18, - 8, - 19, - 20, - 11, - 7, - 8, - 18, - 11, - 17, - 25, - 8, - 17, - 18, - 13, - 14, - 67, - 41, - 18, - 19, - 12, - 9, - 17, - 15, - 15, - 14, - 14, - 17, - 9, - 18, - 16, - 13, - 18, - 13, - 9, - 17, - 19, - 20, - 15, - 25, - 14, - 13, - 16, - 19, - 12, - 14, - 60, - 23, - 23, - 16, - 18, - 12, - 21, - 15, - 43, - 22, - 18, - 25, - 17, - 15, - 10, - 17, - 14, - 13, - 16, - 10, - 13, - 10, - 9, - 19, - 14, - 16, - 15, - 17, - 16, - 68, - 64, - 50, - 16, - 17, - 11, - 15, - 15, - 35, - 12, - 18, - 16, - 9, - 27, - 15, - 13, - 21, - 13, - 20, - 12, - 13, - 11, - 12, - 20, - 17, - 17, - 22, - 12, - 13, - 27, - 107, - 86, - 14, - 14, - 23, - 14, - 20, - 20, - 34, - 22, - 11, - 17, - 13, - 4, - 8, - 13, - 12, - 7, - 8, - 14, - 6, - 9, - 9, - 17, - 13, - 18, - 16, - 14, - 15, - 21, - 16, - 37, - 13, - 12, - 20, - 10, - 12, - 10, - 11, - 15, - 19, - 15, - 7, - 12, - 13, - 12, - 19, - 12, - 6, - 11, - 22, - 15, - 15, - 13, - 13, - 10, - 10, - 10, - 20, - 30, - 13, - 12, - 12, - 11, - 13, - 9, - 13, - 69, - 32, - 13, - 18, - 8, - 17, - 15, - 13, - 13, - 8, - 15, - 11, - 12, - 16, - 14, - 13, - 12, - 12, - 15, - 12, - 17, - 49, - 11, - 10, - 17, - 12, - 18, - 15, - 13, - 20, - 12, - 14, - 16, - 17, - 20, - 21, - 8, - 14, - 14, - 13, - 14, - 9, - 17, - 14, - 20, - 15, - 17, - 13, - 11, - 19, - 10, - 78, - 60, - 15, - 16, - 16, - 13, - 17, - 14, - 25, - 11, - 17, - 25, - 15, - 14, - 17, - 6, - 16, - 20, - 12, - 11, - 16, - 20, - 13, - 10, - 10, - 22, - 18, - 20, - 20, - 35, - 104, - 17, - 15, - 13, - 15, - 16, - 25, - 20, - 18, - 13, - 13, - 18, - 15, - 24, - 14, - 13, - 13, - 13, - 19, - 9, - 18, - 14, - 16, - 18, - 11, - 12, - 17, - 15, - 24, - 73, - 25, - 30, - 19, - 10, - 18, - 14, - 14, - 21, - 18, - 16, - 13, - 15, - 14, - 27, - 9, - 12, - 18, - 14, - 14, - 13, - 16, - 11, - 18, - 10, - 15, - 12, - 11, - 13, - 42, - 75, - 31, - 12, - 10, - 10, - 10, - 10, - 21, - 15, - 21, - 19, - 12, - 15, - 8, - 13, - 14, - 8, - 18, - 10, - 21, - 16, - 11, - 3, - 16, - 11, - 8, - 13, - 12, - 11, - 23, - 17, - 13, - 21, - 16, - 13, - 15, - 20, - 19, - 13, - 18, - 24, - 9, - 15, - 10, - 13, - 13, - 18, - 15, - 14, - 12, - 15, - 14, - 12, - 16, - 19, - 20, - 18, - 18, - 24, - 41, - 19, - 14, - 10, - 11, - 19, - 16, - 9, - 25, - 9, - 7, - 15, - 22, - 15, - 12, - 10, - 18, - 19, - 10, - 11, - 11, - 21, - 10, - 18, - 19, - 11, - 11, - 14, - 11, - 39, - 60, - 14, - 12, - 11, - 17, - 12, - 24, - 17, - 18, - 8, - 14, - 15, - 9, - 12, - 24, - 10, - 10, - 14, - 17, - 15, - 9, - 16, - 15, - 10, - 14, - 19, - 14, - 16, - 20, - 49, - 22, - 19, - 9, - 16, - 13, - 9, - 8, - 19, - 26, - 11, - 15, - 18, - 16, - 11, - 11, - 9, - 12, - 9, - 14, - 16, - 16, - 20, - 11, - 18, - 10, - 11, - 21, - 10, - 19, - 113, - 143, - 124, - 15, - 9, - 18, - 16, - 20, - 15, - 14, - 14, - 15, - 15, - 15, - 18, - 13, - 12, - 11, - 10, - 14, - 13, - 9, - 13, - 20, - 12, - 10, - 10, - 20, - 11, - 31, - 19, - 14, - 9, - 14, - 13, - 21, - 12, - 12, - 27, - 14, - 28, - 14, - 15, - 20, - 20, - 10, - 11, - 13, - 16, - 14, - 11, - 18, - 11, - 18, - 10, - 13, - 18, - 12, - 12, - 70, - 25, - 12, - 10, - 28, - 11, - 19, - 12, - 17, - 12, - 11, - 12, - 15, - 24, - 12, - 7, - 15, - 10, - 13, - 19, - 23, - 16, - 12, - 18, - 15, - 15, - 17, - 14, - 16, - 36, - 76, - 19, - 11, - 13, - 13, - 15, - 14, - 18, - 22, - 13, - 20, - 10, - 12, - 18, - 15, - 8, - 14, - 7, - 12, - 14, - 11, - 19, - 11, - 11, - 8, - 13, - 22, - 13, - 10, - 39, - 21, - 30, - 16, - 21, - 16, - 13, - 19, - 52, - 15, - 14, - 20, - 11, - 15, - 16, - 18, - 17, - 16, - 18, - 13, - 24, - 10, - 22, - 9, - 16, - 14, - 16, - 26, - 19, - 43, - 129, - 152, - 85, - 21, - 23, - 21, - 16, - 21, - 16, - 13, - 16, - 16, - 22, - 11, - 15, - 18, - 22, - 16, - 15, - 11, - 18, - 16, - 7, - 7, - 11, - 9, - 13, - 15, - 19, - 24, - 17, - 28, - 13, - 11, - 14, - 13, - 14, - 19, - 16, - 8, - 21, - 16, - 14, - 27, - 17, - 15, - 10, - 16, - 14, - 12, - 16, - 9, - 8, -} diff --git a/vendor/github.com/VividCortex/gohistogram/weightedhistogram.go b/vendor/github.com/VividCortex/gohistogram/weightedhistogram.go deleted file mode 100644 index 16eed371..00000000 --- a/vendor/github.com/VividCortex/gohistogram/weightedhistogram.go +++ /dev/null @@ -1,190 +0,0 @@ -// Package gohistogram contains implementations of weighted and exponential histograms. -package gohistogram - -// Copyright (c) 2013 VividCortex, Inc. All rights reserved. -// Please see the LICENSE file for applicable license terms. - -import "fmt" - -// A WeightedHistogram implements Histogram. A WeightedHistogram has bins that have values -// which are exponentially weighted moving averages. This allows you keep inserting large -// amounts of data into the histogram and approximate quantiles with recency factored in. -type WeightedHistogram struct { - bins []bin - maxbins int - total float64 - alpha float64 -} - -// NewWeightedHistogram returns a new WeightedHistogram with a maximum of n bins with a decay factor -// of alpha. -// -// There is no "optimal" bin count, but somewhere between 20 and 80 bins should be -// sufficient. -// -// Alpha should be set to 2 / (N+1), where N represents the average age of the moving window. -// For example, a 60-second window with an average age of 30 seconds would yield an -// alpha of 0.064516129. -func NewWeightedHistogram(n int, alpha float64) *WeightedHistogram { - return &WeightedHistogram{ - bins: make([]bin, 0), - maxbins: n, - total: 0, - alpha: alpha, - } -} - -func ewma(existingVal float64, newVal float64, alpha float64) (result float64) { - result = newVal*(1-alpha) + existingVal*alpha - return -} - -func (h *WeightedHistogram) scaleDown(except int) { - for i := range h.bins { - if i != except { - h.bins[i].count = ewma(h.bins[i].count, 0, h.alpha) - } - } -} - -func (h *WeightedHistogram) Add(n float64) { - defer h.trim() - for i := range h.bins { - if h.bins[i].value == n { - h.bins[i].count++ - - defer h.scaleDown(i) - return - } - - if h.bins[i].value > n { - - newbin := bin{value: n, count: 1} - head := append(make([]bin, 0), h.bins[0:i]...) - - head = append(head, newbin) - tail := h.bins[i:] - h.bins = append(head, tail...) - - defer h.scaleDown(i) - return - } - } - - h.bins = append(h.bins, bin{count: 1, value: n}) -} - -func (h *WeightedHistogram) Quantile(q float64) float64 { - count := q * h.total - for i := range h.bins { - count -= float64(h.bins[i].count) - - if count <= 0 { - return h.bins[i].value - } - } - - return -1 -} - -// CDF returns the value of the cumulative distribution function -// at x -func (h *WeightedHistogram) CDF(x float64) float64 { - count := 0.0 - for i := range h.bins { - if h.bins[i].value <= x { - count += float64(h.bins[i].count) - } - } - - return count / h.total -} - -// Mean returns the sample mean of the distribution -func (h *WeightedHistogram) Mean() float64 { - if h.total == 0 { - return 0 - } - - sum := 0.0 - - for i := range h.bins { - sum += h.bins[i].value * h.bins[i].count - } - - return sum / h.total -} - -// Variance returns the variance of the distribution -func (h *WeightedHistogram) Variance() float64 { - if h.total == 0 { - return 0 - } - - sum := 0.0 - mean := h.Mean() - - for i := range h.bins { - sum += (h.bins[i].count * (h.bins[i].value - mean) * (h.bins[i].value - mean)) - } - - return sum / h.total -} - -func (h *WeightedHistogram) Count() float64 { - return h.total -} - -func (h *WeightedHistogram) trim() { - total := 0.0 - for i := range h.bins { - total += h.bins[i].count - } - h.total = total - for len(h.bins) > h.maxbins { - - // Find closest bins in terms of value - minDelta := 1e99 - minDeltaIndex := 0 - for i := range h.bins { - if i == 0 { - continue - } - - if delta := h.bins[i].value - h.bins[i-1].value; delta < minDelta { - minDelta = delta - minDeltaIndex = i - } - } - - // We need to merge bins minDeltaIndex-1 and minDeltaIndex - totalCount := h.bins[minDeltaIndex-1].count + h.bins[minDeltaIndex].count - mergedbin := bin{ - value: (h.bins[minDeltaIndex-1].value* - h.bins[minDeltaIndex-1].count + - h.bins[minDeltaIndex].value* - h.bins[minDeltaIndex].count) / - totalCount, // weighted average - count: totalCount, // summed heights - } - head := append(make([]bin, 0), h.bins[0:minDeltaIndex-1]...) - tail := append([]bin{mergedbin}, h.bins[minDeltaIndex+1:]...) - h.bins = append(head, tail...) - } -} - -// String returns a string reprentation of the histogram, -// which is useful for printing to a terminal. -func (h *WeightedHistogram) String() (str string) { - str += fmt.Sprintln("Total:", h.total) - - for i := range h.bins { - var bar string - for j := 0; j < int(float64(h.bins[i].count)/float64(h.total)*200); j++ { - bar += "." - } - str += fmt.Sprintln(h.bins[i].value, "\t", bar) - } - - return -} diff --git a/vendor/github.com/aws/aws-sdk-go/.gitignore b/vendor/github.com/aws/aws-sdk-go/.gitignore deleted file mode 100644 index fb11ceca..00000000 --- a/vendor/github.com/aws/aws-sdk-go/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -dist -/doc -/doc-staging -.yardoc -Gemfile.lock -awstesting/integration/smoke/**/importmarker__.go -awstesting/integration/smoke/_test/ -/vendor/bin/ -/vendor/pkg/ -/vendor/src/ -/private/model/cli/gen-api/gen-api diff --git a/vendor/github.com/aws/aws-sdk-go/.godoc_config b/vendor/github.com/aws/aws-sdk-go/.godoc_config deleted file mode 100644 index 395878d6..00000000 --- a/vendor/github.com/aws/aws-sdk-go/.godoc_config +++ /dev/null @@ -1,14 +0,0 @@ -{ - "PkgHandler": { - "Pattern": "/sdk-for-go/api/", - "StripPrefix": "/sdk-for-go/api", - "Include": ["/src/github.com/aws/aws-sdk-go/aws", "/src/github.com/aws/aws-sdk-go/service"], - "Exclude": ["/src/cmd", "/src/github.com/aws/aws-sdk-go/awstesting", "/src/github.com/aws/aws-sdk-go/awsmigrate"], - "IgnoredSuffixes": ["iface"] - }, - "Github": { - "Tag": "master", - "Repo": "/aws/aws-sdk-go", - "UseGithub": true - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/.travis.yml b/vendor/github.com/aws/aws-sdk-go/.travis.yml deleted file mode 100644 index bcefd1c5..00000000 --- a/vendor/github.com/aws/aws-sdk-go/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: go - -sudo: required - -go: - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - tip - -# Use Go 1.5's vendoring experiment for 1.5 tests. -env: - - GO15VENDOREXPERIMENT=1 - -install: - - make get-deps - -script: - - make unit-with-race-cover - -matrix: - allow_failures: - - go: tip diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md deleted file mode 100644 index 9731b788..00000000 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md +++ /dev/null @@ -1,2078 +0,0 @@ -Release v1.12.16 (2017-10-23) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/organizations`: Updates service API and documentation - * This release supports integrating other AWS services with AWS Organizations through the use of an IAM service-linked role called AWSServiceRoleForOrganizations. Certain operations automatically create that role if it does not already exist. - -Release v1.12.15 (2017-10-20) -=== - -### Service Client Updates -* `service/ec2`: Updates service API and documentation - * Adding pagination support for DescribeSecurityGroups for EC2 Classic and VPC Security Groups - -Release v1.12.14 (2017-10-19) -=== - -### Service Client Updates -* `service/sqs`: Updates service API and documentation - * Added support for tracking cost allocation by adding, updating, removing, and listing the metadata tags of Amazon SQS queues. -* `service/ssm`: Updates service API and documentation - * EC2 Systems Manager versioning support for Parameter Store. Also support for referencing parameter versions in SSM Documents. - -Release v1.12.13 (2017-10-18) -=== - -### Service Client Updates -* `service/lightsail`: Updates service API and documentation - * This release adds support for Windows Server-based Lightsail instances. The GetInstanceAccessDetails API now returns the password of your Windows Server-based instance when using the default key pair. GetInstanceAccessDetails also returns a PasswordData object for Windows Server instances containing the ciphertext and keyPairName. The Blueprint data type now includes a list of platform values (LINUX_UNIX or WINDOWS). The Bundle data type now includes a list of SupportedPlatforms values (LINUX_UNIX or WINDOWS). - -Release v1.12.12 (2017-10-17) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/es`: Updates service API and documentation - * This release adds support for VPC access to Amazon Elasticsearch Service. - * This release adds support for VPC access to Amazon Elasticsearch Service. - -Release v1.12.11 (2017-10-16) -=== - -### Service Client Updates -* `service/cloudhsm`: Updates service API and documentation - * Documentation updates for AWS CloudHSM Classic. -* `service/ec2`: Updates service API and documentation - * You can now change the tenancy of your VPC from dedicated to default with a single API operation. For more details refer to the documentation for changing VPC tenancy. -* `service/es`: Updates service API and documentation - * AWS Elasticsearch adds support for enabling slow log publishing. Using slow log publishing options customers can configure and enable index/query slow log publishing of their domain to preferred AWS Cloudwatch log group. -* `service/rds`: Updates service API and waiters - * Adds waiters for DBSnapshotAvailable and DBSnapshotDeleted. -* `service/waf`: Updates service API and documentation - * This release adds support for regular expressions as match conditions in rules, and support for geographical location by country of request IP address as a match condition in rules. -* `service/waf-regional`: Updates service API and documentation - -Release v1.12.10 (2017-10-12) -=== - -### Service Client Updates -* `service/codecommit`: Updates service API and documentation - * This release includes the DeleteBranch API and a change to the contents of a Commit object. -* `service/dms`: Updates service API and documentation - * This change includes addition of new optional parameter to an existing API -* `service/elasticbeanstalk`: Updates service API and documentation - * Added the ability to add, delete or update Tags -* `service/polly`: Updates service API - * Amazon Polly exposes two new voices: "Matthew" (US English) and "Takumi" (Japanese) -* `service/rds`: Updates service API and documentation - * You can now call DescribeValidDBInstanceModifications to learn what modifications you can make to your DB instance. You can use this information when you call ModifyDBInstance. - -Release v1.12.9 (2017-10-11) -=== - -### Service Client Updates -* `service/ecr`: Updates service API, documentation, and paginators - * Adds support for new API set used to manage Amazon ECR repository lifecycle policies. Amazon ECR lifecycle policies enable you to specify the lifecycle management of images in a repository. The configuration is a set of one or more rules, where each rule defines an action for Amazon ECR to apply to an image. This allows the automation of cleaning up unused images, for example expiring images based on age or status. A lifecycle policy preview API is provided as well, which allows you to see the impact of a lifecycle policy on an image repository before you execute it -* `service/email`: Updates service API and documentation - * Added content related to email template management and templated email sending operations. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.8 (2017-10-10) -=== - -### Service Client Updates -* `service/ec2`: Updates service API and documentation - * This release includes updates to AWS Virtual Private Gateway. -* `service/elasticloadbalancingv2`: Updates service API and documentation -* `service/opsworkscm`: Updates service API and documentation - * Provide engine specific information for node associations. - -Release v1.12.7 (2017-10-06) -=== - -### Service Client Updates -* `service/sqs`: Updates service documentation - * Documentation updates regarding availability of FIFO queues and miscellaneous corrections. - -Release v1.12.6 (2017-10-05) -=== - -### Service Client Updates -* `service/redshift`: Updates service API and documentation - * DescribeEventSubscriptions API supports tag keys and tag values as request parameters. - -Release v1.12.5 (2017-10-04) -=== - -### Service Client Updates -* `service/kinesisanalytics`: Updates service API and documentation - * Kinesis Analytics now supports schema discovery on objects in S3. Additionally, Kinesis Analytics now supports input data preprocessing through Lambda. -* `service/route53domains`: Updates service API and documentation - * Added a new API that checks whether a domain name can be transferred to Amazon Route 53. - -### SDK Bugs -* `service/s3/s3crypto`: Correct PutObjectRequest documentation ([#1568](https://github.com/aws/aws-sdk-go/pull/1568)) - * s3Crypto's PutObjectRequest docstring example was using an incorrect value. Corrected the type used in the example. -Release v1.12.4 (2017-10-03) -=== - -### Service Client Updates -* `service/ec2`: Updates service API, documentation, and waiters - * This release includes service updates to AWS VPN. -* `service/ssm`: Updates service API and documentation - * EC2 Systems Manager support for tagging SSM Documents. Also support for tag-based permissions to restrict access to SSM Documents based on these tags. - -Release v1.12.3 (2017-10-02) -=== - -### Service Client Updates -* `service/cloudhsm`: Updates service documentation and paginators - * Documentation updates for CloudHSM - -Release v1.12.2 (2017-09-29) -=== - -### Service Client Updates -* `service/appstream`: Updates service API and documentation - * Includes APIs for managing and accessing image builders, and deleting images. -* `service/codebuild`: Updates service API and documentation - * Adding support for Building GitHub Pull Requests in AWS CodeBuild -* `service/mturk-requester`: Updates service API and documentation -* `service/organizations`: Updates service API and documentation - * This release flags the HandshakeParty structure's Type and Id fields as 'required'. They effectively were required in the past, as you received an error if you did not include them. This is now reflected at the API definition level. -* `service/route53`: Updates service API and documentation - * This change allows customers to reset elements of health check. - -### SDK Bugs -* `private/protocol/query`: Fix query protocol handling of nested byte slices ([#1557](https://github.com/aws/aws-sdk-go/issues/1557)) - * Fixes the query protocol to correctly marshal nested []byte values of API operations. -* `service/s3`: Fix PutObject and UploadPart API to include ContentMD5 field ([#1559](https://github.com/aws/aws-sdk-go/pull/1559)) - * Fixes the SDK's S3 PutObject and UploadPart API code generation to correctly render the ContentMD5 field into the associated input types for these two API operations. - * Fixes [#1553](https://github.com/aws/aws-sdk-go/pull/1553) -Release v1.12.1 (2017-09-27) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/pinpoint`: Updates service API and documentation - * Added two new push notification channels: Amazon Device Messaging (ADM) and, for push notification support in China, Baidu Cloud Push. Added support for APNs auth via .p8 key file. Added operation for direct message deliveries to user IDs, enabling you to message an individual user on multiple endpoints. - -Release v1.12.0 (2017-09-26) -=== - -### SDK Bugs -* `API Marshaler`: Revert REST JSON and XML protocol marshaler improvements - * Bug [#1550](https://github.com/aws/aws-sdk-go/issues/1550) identified a missed condition in the Amazon Route 53 RESTXML protocol marshaling causing requests to that service to fail. Reverting the marshaler improvements until the bug can be fixed. - -Release v1.11.0 (2017-09-26) -=== - -### Service Client Updates -* `service/cloudformation`: Updates service API and documentation - * You can now prevent a stack from being accidentally deleted by enabling termination protection on the stack. If you attempt to delete a stack with termination protection enabled, the deletion fails and the stack, including its status, remains unchanged. You can enable termination protection on a stack when you create it. Termination protection on stacks is disabled by default. After creation, you can set termination protection on a stack whose status is CREATE_COMPLETE, UPDATE_COMPLETE, or UPDATE_ROLLBACK_COMPLETE. - -### SDK Features -* Add dep Go dependency management metadata files (#1544) - * Adds the Go `dep` dependency management metadata files to the SDK. - * Fixes [#1451](https://github.com/aws/aws-sdk-go/issues/1451) - * Fixes [#634](https://github.com/aws/aws-sdk-go/issues/634) -* `service/dynamodb/expression`: Add expression building utility for DynamoDB ([#1527](https://github.com/aws/aws-sdk-go/pull/1527)) - * Adds a new package, expression, to the SDK providing builder utilities to create DynamoDB expressions safely taking advantage of type safety. -* `API Marshaler`: Add generated marshalers for RESTXML protocol ([#1409](https://github.com/aws/aws-sdk-go/pull/1409)) - * Updates the RESTXML protocol marshaler to use generated code instead of reflection for REST XML based services. -* `API Marshaler`: Add generated marshalers for RESTJSON protocol ([#1547](https://github.com/aws/aws-sdk-go/pull/1547)) - * Updates the RESTJSON protocol marshaler to use generated code instead of reflection for REST JSON based services. - -### SDK Enhancements -* `private/protocol`: Update format of REST JSON and XMl benchmarks ([#1546](https://github.com/aws/aws-sdk-go/pull/1546)) - * Updates the format of the REST JSON and XML benchmarks to be readable. RESTJSON benchmarks were updated to more accurately bench building of the protocol. - -Release v1.10.51 (2017-09-22) -=== - -### Service Client Updates -* `service/config`: Updates service API and documentation -* `service/ecs`: Updates service API and documentation - * Amazon ECS users can now add and drop Linux capabilities to their containers through the use of docker's cap-add and cap-drop features. Customers can specify the capabilities they wish to add or drop for each container in their task definition. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rds`: Updates service documentation - * Documentation updates for rds - -Release v1.10.50 (2017-09-21) -=== - -### Service Client Updates -* `service/budgets`: Updates service API - * Including "DuplicateRecordException" in UpdateNotification and UpdateSubscriber. -* `service/ec2`: Updates service API and documentation - * Add EC2 APIs to copy Amazon FPGA Images (AFIs) within the same region and across multiple regions, delete AFIs, and modify AFI attributes. AFI attributes include name, description and granting/denying other AWS accounts to load the AFI. -* `service/logs`: Updates service API and documentation - * Adds support for associating LogGroups with KMS Keys. - -### SDK Bugs -* Fix greengrass service model being duplicated with different casing. ([#1541](https://github.com/aws/aws-sdk-go/pull/1541)) - * Fixes [#1540](https://github.com/aws/aws-sdk-go/issues/1540) - * Fixes [#1539](https://github.com/aws/aws-sdk-go/issues/1539) -Release v1.10.49 (2017-09-20) -=== - -### Service Client Updates -* `service/Greengrass`: Adds new service -* `service/appstream`: Updates service API and documentation - * API updates for supporting On-Demand fleets. -* `service/codepipeline`: Updates service API and documentation - * This change includes a PipelineMetadata object that is part of the output from the GetPipeline API that includes the Pipeline ARN, created, and updated timestamp. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rds`: Updates service API and documentation - * Introduces the --option-group-name parameter to the ModifyDBSnapshot CLI command. You can specify this parameter when you upgrade an Oracle DB snapshot. The same option group considerations apply when upgrading a DB snapshot as when upgrading a DB instance. For more information, see http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Oracle.html#USER_UpgradeDBInstance.Oracle.OGPG.OG -* `service/runtime.lex`: Updates service API and documentation - -Release v1.10.48 (2017-09-19) -=== - -### Service Client Updates -* `service/ec2`: Updates service API - * Fixed bug in EC2 clients preventing ElasticGpuSet from being set. - -### SDK Enhancements -* `aws/credentials`: Add EnvProviderName constant. ([#1531](https://github.com/aws/aws-sdk-go/issues/1531)) - * Adds the "EnvConfigCredentials" string literal as EnvProviderName constant. - * Fixes [#1444](https://github.com/aws/aws-sdk-go/issues/1444) - -Release v1.10.47 (2017-09-18) -=== - -### Service Client Updates -* `service/ec2`: Updates service API and documentation - * Amazon EC2 now lets you opt for Spot instances to be stopped in the event of an interruption instead of being terminated. Your Spot request can be fulfilled again by restarting instances from a previously stopped state, subject to availability of capacity at or below your preferred price. When you submit a persistent Spot request, you can choose from "terminate" or "stop" as the instance interruption behavior. Choosing "stop" will shutdown your Spot instances so you can continue from this stopped state later on. This feature is only available for instances with Amazon EBS volume as their root device. -* `service/email`: Updates service API and documentation - * Amazon Simple Email Service (Amazon SES) now lets you customize the domains used for tracking open and click events. Previously, open and click tracking links referred to destinations hosted on domains operated by Amazon SES. With this feature, you can use your own branded domains for capturing open and click events. -* `service/iam`: Updates service API and documentation - * A new API, DeleteServiceLinkedRole, submits a service-linked role deletion request and returns a DeletionTaskId, which you can use to check the status of the deletion. - -Release v1.10.46 (2017-09-15) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * Add a new enum "REQUEST" to '--type ' field in the current create-authorizer API, and make "identitySource" optional. - -Release v1.10.45 (2017-09-14) -=== - -### Service Client Updates -* `service/codebuild`: Updates service API and documentation - * Supporting Parameter Store in environment variables for AWS CodeBuild -* `service/organizations`: Updates service documentation - * Documentation updates for AWS Organizations -* `service/servicecatalog`: Updates service API, documentation, and paginators - * This release of Service Catalog adds API support to copy products. - -Release v1.10.44 (2017-09-13) -=== - -### Service Client Updates -* `service/autoscaling`: Updates service API and documentation - * Customers can create Life Cycle Hooks at the time of creating Auto Scaling Groups through the CreateAutoScalingGroup API -* `service/batch`: Updates service documentation and examples - * Documentation updates for batch -* `service/ec2`: Updates service API - * You are now able to create and launch EC2 x1e.32xlarge instance, a new EC2 instance in the X1 family, in us-east-1, us-west-2, eu-west-1, and ap-northeast-1. x1e.32xlarge offers 128 vCPUs, 3,904 GiB of DDR4 instance memory, high memory bandwidth, large L3 caches, and leading reliability capabilities to boost the performance and reliability of in-memory applications. -* `service/events`: Updates service API and documentation - * Exposes ConcurrentModificationException as one of the valid exceptions for PutPermission and RemovePermission operation. - -### SDK Enhancements -* `service/autoscaling`: Fix documentation for PutScalingPolicy.AutoScalingGroupName [#1522](https://github.com/aws/aws-sdk-go/pull/1522) -* `service/s3/s3manager`: Clarify S3 Upload manager Concurrency config [#1521](https://github.com/aws/aws-sdk-go/pull/1521) - * Fixes [#1458](https://github.com/aws/aws-sdk-go/issues/1458) -* `service/dynamodb/dynamodbattribute`: Add support for time alias. [#1520](https://github.com/aws/aws-sdk-go/pull/1520) - * Related to [#1505](https://github.com/aws/aws-sdk-go/pull/1505) - -Release v1.10.43 (2017-09-12) -=== - -### Service Client Updates -* `service/ec2`: Updates service API - * Fixed bug in EC2 clients preventing HostOfferingSet from being set -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.10.42 (2017-09-12) -=== - -### Service Client Updates -* `service/devicefarm`: Updates service API and documentation - * DeviceFarm has added support for two features - RemoteDebugging and Customer Artifacts. Customers can now do remote Debugging on their Private Devices and can now retrieve custom files generated by their tests on the device and the device host (execution environment) on both public and private devices. - -Release v1.10.41 (2017-09-08) -=== - -### Service Client Updates -* `service/logs`: Updates service API and documentation - * Adds support for the PutResourcePolicy, DescribeResourcePolicy and DeleteResourcePolicy APIs. - -Release v1.10.40 (2017-09-07) -=== - -### Service Client Updates -* `service/application-autoscaling`: Updates service documentation -* `service/ec2`: Updates service API and documentation - * With Tagging support, you can add Key and Value metadata to search, filter and organize your NAT Gateways according to your organization's needs. -* `service/elasticloadbalancingv2`: Updates service API and documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lex-models`: Updates service API and documentation -* `service/route53`: Updates service API and documentation - * You can configure Amazon Route 53 to log information about the DNS queries that Amazon Route 53 receives for your domains and subdomains. When you configure query logging, Amazon Route 53 starts to send logs to CloudWatch Logs. You can use various tools, including the AWS console, to access the query logs. - -Release v1.10.39 (2017-09-06) -=== - -### Service Client Updates -* `service/budgets`: Updates service API and documentation - * Add an optional "thresholdType" to notifications to support percentage or absolute value thresholds. - -Release v1.10.38 (2017-09-05) -=== - -### Service Client Updates -* `service/codestar`: Updates service API and documentation - * Added support to tag CodeStar projects. Tags can be used to organize and find CodeStar projects on key-value pairs that you can choose. For example, you could add a tag with a key of "Release" and a value of "Beta" to projects your organization is working on for an upcoming beta release. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.10.37 (2017-09-01) -=== - -### Service Client Updates -* `service/MobileHub`: Adds new service -* `service/gamelift`: Updates service API and documentation - * GameLift VPC resources can be peered with any other AWS VPC. R4 memory-optimized instances now available to deploy. -* `service/ssm`: Updates service API and documentation - * Adding KMS encryption support to SSM Inventory Resource Data Sync. Exposes the ClientToken parameter on SSM StartAutomationExecution to provide idempotent execution requests. - -Release v1.10.36 (2017-08-31) -=== - -### Service Client Updates -* `service/codebuild`: Updates service API, documentation, and examples - * The AWS CodeBuild HTTP API now provides the BatchDeleteBuilds operation, which enables you to delete existing builds. -* `service/ec2`: Updates service API and documentation - * Descriptions for Security Group Rules enables customers to be able to define a description for ingress and egress security group rules . The Descriptions for Security Group Rules feature supports one description field per Security Group rule for both ingress and egress rules . Descriptions for Security Group Rules provides a simple way to describe the purpose or function of a Security Group Rule allowing for easier customer identification of configuration elements . Prior to the release of Descriptions for Security Group Rules , customers had to maintain a separate system outside of AWS if they wanted to track Security Group Rule mapping and their purpose for being implemented. If a security group rule has already been created and you would like to update or change your description for that security group rule you can use the UpdateSecurityGroupRuleDescription API. -* `service/elasticloadbalancingv2`: Updates service API and documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lex-models`: Updates service API and documentation - -### SDK Bugs -* `aws/signer/v4`: Revert [#1491](https://github.com/aws/aws-sdk-go/issues/1491) as change conflicts with an undocumented AWS v4 signature test case. - * Related to: [#1495](https://github.com/aws/aws-sdk-go/issues/1495). -Release v1.10.35 (2017-08-30) -=== - -### Service Client Updates -* `service/application-autoscaling`: Updates service API and documentation -* `service/organizations`: Updates service API and documentation - * The exception ConstraintViolationException now contains a new reason subcode MASTERACCOUNT_MISSING_CONTACT_INFO to make it easier to understand why attempting to remove an account from an Organization can fail. We also improved several other of the text descriptions and examples. - -Release v1.10.34 (2017-08-29) -=== - -### Service Client Updates -* `service/config`: Updates service API and documentation -* `service/ec2`: Updates service API and documentation - * Provides capability to add secondary CIDR blocks to a VPC. - -### SDK Bugs -* `aws/signer/v4`: Fix Signing Unordered Multi Value Query Parameters ([#1491](https://github.com/aws/aws-sdk-go/pull/1491)) - * Removes sorting of query string values when calculating v4 signing as this is not part of the spec. The spec only requires the keys, not values, to be sorted which is achieved by Query.Encode(). -Release v1.10.33 (2017-08-25) -=== - -### Service Client Updates -* `service/cloudformation`: Updates service API and documentation - * Rollback triggers enable you to have AWS CloudFormation monitor the state of your application during stack creation and updating, and to roll back that operation if the application breaches the threshold of any of the alarms you've specified. -* `service/gamelift`: Updates service API - * Update spelling of MatchmakingTicket status values for internal consistency. -* `service/rds`: Updates service API and documentation - * Option group options now contain additional properties that identify requirements for certain options. Check these properties to determine if your DB instance must be in a VPC or have auto minor upgrade turned on before you can use an option. Check to see if you can downgrade the version of an option after you have installed it. - -### SDK Enhancements -* `example/service/ec2`: Add EC2 list instances example ([#1492](https://github.com/aws/aws-sdk-go/pull/1492)) - -Release v1.10.32 (2017-08-25) -=== - -### Service Client Updates -* `service/rekognition`: Updates service API, documentation, and examples - * Update the enum value of LandmarkType and GenderType to be consistent with service response - -Release v1.10.31 (2017-08-23) -=== - -### Service Client Updates -* `service/appstream`: Updates service documentation - * Documentation updates for appstream -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.10.30 (2017-08-22) -=== - -### Service Client Updates -* `service/ssm`: Updates service API and documentation - * Changes to associations in Systems Manager State Manager can now be recorded. Previously, when you edited associations, you could not go back and review older association settings. Now, associations are versioned, and can be named using human-readable strings, allowing you to see a trail of association changes. You can also perform rate-based scheduling, which allows you to schedule associations more granularly. - -Release v1.10.29 (2017-08-21) -=== - -### Service Client Updates -* `service/firehose`: Updates service API, documentation, and paginators - * This change will allow customers to attach a Firehose delivery stream to an existing Kinesis stream directly. You no longer need a forwarder to move data from a Kinesis stream to a Firehose delivery stream. You can now run your streaming applications on your Kinesis stream and easily attach a Firehose delivery stream to it for data delivery to S3, Redshift, or Elasticsearch concurrently. -* `service/route53`: Updates service API and documentation - * Amazon Route 53 now supports CAA resource record type. A CAA record controls which certificate authorities are allowed to issue certificates for the domain or subdomain. - -Release v1.10.28 (2017-08-18) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.10.27 (2017-08-16) -=== - -### Service Client Updates -* `service/gamelift`: Updates service API and documentation - * The Matchmaking Grouping Service is a new feature that groups player match requests for a given game together into game sessions based on developer configured rules. - -### SDK Enhancements -* `aws/arn`: aws/arn: Package for parsing and producing ARNs ([#1463](https://github.com/aws/aws-sdk-go/pull/1463)) - * Adds the `arn` package for AWS ARN parsing and building. Use this package to build AWS ARNs for services such as outlined in the [documentation](http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). - -### SDK Bugs -* `aws/signer/v4`: Correct V4 presign signature to include content sha25 in URL ([#1469](https://github.com/aws/aws-sdk-go/pull/1469)) - * Updates the V4 signer so that when a Presign is generated the `X-Amz-Content-Sha256` header is added to the query string instead of being required to be in the header. This allows you to generate presigned URLs for GET requests, e.g S3.GetObject that do not require additional headers to be set by the downstream users of the presigned URL. - * Related To: [#1467](https://github.com/aws/aws-sdk-go/issues/1467) - -Release v1.10.26 (2017-08-15) -=== - -### Service Client Updates -* `service/ec2`: Updates service API - * Fixed bug in EC2 clients preventing HostReservation from being set -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.10.25 (2017-08-14) -=== - -### Service Client Updates -* `service/AWS Glue`: Adds new service -* `service/batch`: Updates service API and documentation - * This release enhances the DescribeJobs API to include the CloudWatch logStreamName attribute in ContainerDetail and ContainerDetailAttempt -* `service/cloudhsmv2`: Adds new service - * CloudHSM provides hardware security modules for protecting sensitive data and cryptographic keys within an EC2 VPC, and enable the customer to maintain control over key access and use. This is a second-generation of the service that will improve security, lower cost and provide better customer usability. -* `service/elasticfilesystem`: Updates service API, documentation, and paginators - * Customers can create encrypted EFS file systems and specify a KMS master key to encrypt it with. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/mgh`: Adds new service - * AWS Migration Hub provides a single location to track migrations across multiple AWS and partner solutions. Using Migration Hub allows you to choose the AWS and partner migration tools that best fit your needs, while providing visibility into the status of your entire migration portfolio. Migration Hub also provides key metrics and progress for individual applications, regardless of which tools are being used to migrate them. For example, you might use AWS Database Migration Service, AWS Server Migration Service, and partner migration tools to migrate an application comprised of a database, virtualized web servers, and a bare metal server. Using Migration Hub will provide you with a single screen that shows the migration progress of all the resources in the application. This allows you to quickly get progress updates across all of your migrations, easily identify and troubleshoot any issues, and reduce the overall time and effort spent on your migration projects. Migration Hub is available to all AWS customers at no additional charge. You only pay for the cost of the migration tools you use, and any resources being consumed on AWS. -* `service/ssm`: Updates service API and documentation - * Systems Manager Maintenance Windows include the following changes or enhancements: New task options using Systems Manager Automation, AWS Lambda, and AWS Step Functions; enhanced ability to edit the targets of a Maintenance Window, including specifying a target name and description, and ability to edit the owner field; enhanced ability to edits tasks; enhanced support for Run Command parameters; and you can now use a --safe flag when attempting to deregister a target. If this flag is enabled when you attempt to deregister a target, the system returns an error if the target is referenced by any task. Also, Systems Manager now includes Configuration Compliance to scan your fleet of managed instances for patch compliance and configuration inconsistencies. You can collect and aggregate data from multiple AWS accounts and Regions, and then drill down into specific resources that aren't compliant. -* `service/storagegateway`: Updates service API and documentation - * Add optional field ForceDelete to DeleteFileShare api. - -Release v1.10.24 (2017-08-11) -=== - -### Service Client Updates -* `service/codedeploy`: Updates service API and documentation - * Adds support for specifying Application Load Balancers in deployment groups, for both in-place and blue/green deployments. -* `service/cognito-idp`: Updates service API and documentation -* `service/ec2`: Updates service API and documentation - * Provides customers an opportunity to recover an EIP that was released - -Release v1.10.23 (2017-08-10) -=== - -### Service Client Updates -* `service/clouddirectory`: Updates service API and documentation - * Enable BatchDetachPolicy -* `service/codebuild`: Updates service API - * Supporting Bitbucket as source type in AWS CodeBuild. - -Release v1.10.22 (2017-08-09) -=== - -### Service Client Updates -* `service/rds`: Updates service documentation - * Documentation updates for RDS. - -Release v1.10.21 (2017-08-09) -=== - -### Service Client Updates -* `service/elasticbeanstalk`: Updates service API and documentation - * Add support for paginating the result of DescribeEnvironments Include the ARN of described environments in DescribeEnvironments output - -### SDK Enhancements -* `aws`: Add pointer conversion utilities to transform int64 to time.Time [#1433](https://github.com/aws/aws-sdk-go/pull/1433) - * Adds `SecondsTimeValue` and `MillisecondsTimeValue` utilities. - -Release v1.10.20 (2017-08-01) -=== - -### Service Client Updates -* `service/codedeploy`: Updates service API and documentation - * AWS CodeDeploy now supports the use of multiple tag groups in a single deployment group (an intersection of tags) to identify the instances for a deployment. When you create or update a deployment group, use the new ec2TagSet and onPremisesTagSet structures to specify up to three groups of tags. Only instances that are identified by at least one tag in each of the tag groups are included in the deployment group. -* `service/config`: Updates service API and documentation -* `service/ec2`: Updates service waiters - * Ec2 SpotInstanceRequestFulfilled waiter update -* `service/elasticloadbalancingv2`: Updates service waiters -* `service/email`: Updates service API, documentation, paginators, and examples - * This update adds information about publishing email open and click events. This update also adds information about publishing email events to Amazon Simple Notification Service (Amazon SNS). -* `service/pinpoint`: Updates service API and documentation - * This release of the Pinpoint SDK enables App management - create, delete, update operations, Raw Content delivery for APNs and GCM campaign messages and From Address override. - -Release v1.10.19 (2017-08-01) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/inspector`: Updates service API, documentation, and paginators - * Inspector's StopAssessmentRun API has been updated with a new input option - stopAction. This request parameter can be set to either START_EVALUATION or SKIP_EVALUATION. START_EVALUATION (the default value, and the previous behavior) stops the AWS agent data collection and begins the results evaluation for findings generation based on the data collected so far. SKIP_EVALUATION cancels the assessment run immediately, after which no findings are generated. -* `service/ssm`: Updates service API and documentation - * Adds a SendAutomationSignal API to SSM Service. This API is used to send a signal to an automation execution to change the current behavior or status of the execution. - -Release v1.10.18 (2017-07-27) -=== - -### Service Client Updates -* `service/ec2`: Updates service API and documentation - * The CreateDefaultVPC API enables you to create a new default VPC . You no longer need to contact AWS support, if your default VPC has been deleted. -* `service/kinesisanalytics`: Updates service API and documentation - * Added additional exception types and clarified documentation. - -Release v1.10.17 (2017-07-27) -=== - -### Service Client Updates -* `service/dynamodb`: Updates service documentation and examples - * Corrected a typo. -* `service/ec2`: Updates service API and documentation - * Amazon EC2 Elastic GPUs allow you to easily attach low-cost graphics acceleration to current generation EC2 instances. With Amazon EC2 Elastic GPUs, you can configure the right amount of graphics acceleration to your particular workload without being constrained by fixed hardware configurations and limited GPU selection. -* `service/monitoring`: Updates service documentation - * This release adds high resolution features to CloudWatch, with support for Custom Metrics down to 1 second and Alarms down to 10 seconds. - -Release v1.10.16 (2017-07-26) -=== - -### Service Client Updates -* `service/clouddirectory`: Updates service API and documentation - * Cloud Directory adds support for additional batch operations. -* `service/cloudformation`: Updates service API and documentation - * AWS CloudFormation StackSets enables you to manage stacks across multiple accounts and regions. - -### SDK Enhancements -* `aws/signer/v4`: Optimize V4 signer's header duplicate space stripping. [#1417](https://github.com/aws/aws-sdk-go/pull/1417) - -Release v1.10.15 (2017-07-24) -=== - -### Service Client Updates -* `service/appstream`: Updates service API, documentation, and waiters - * Amazon AppStream 2.0 image builders and fleets can now access applications and network resources that rely on Microsoft Active Directory (AD) for authentication and permissions. This new feature allows you to join your streaming instances to your AD, so you can use your existing AD user management tools. -* `service/ec2`: Updates service API and documentation - * Spot Fleet tagging capability allows customers to automatically tag instances launched by Spot Fleet. You can use this feature to label or distinguish instances created by distinct Spot Fleets. Tagging your EC2 instances also enables you to see instance cost allocation by tag in your AWS bill. - -### SDK Bugs -* `aws/signer/v4`: Fix out of bounds panic in stripExcessSpaces [#1412](https://github.com/aws/aws-sdk-go/pull/1412) - * Fixes the out of bands panic in stripExcessSpaces caused by an incorrect calculation of the stripToIdx value. Simplified to code also. - * Fixes [#1411](https://github.com/aws/aws-sdk-go/issues/1411) -Release v1.10.14 (2017-07-20) -=== - -### Service Client Updates -* `service/elasticmapreduce`: Updates service API and documentation - * Amazon EMR now includes the ability to use a custom Amazon Linux AMI and adjustable root volume size when launching a cluster. - -Release v1.10.13 (2017-07-19) -=== - -### Service Client Updates -* `service/budgets`: Updates service API and documentation - * Update budget Management API's to list/create/update RI_UTILIZATION type budget. Update budget Management API's to support DAILY timeUnit for RI_UTILIZATION type budget. - -### SDK Enhancements -* `service/s3`: Use interfaces assertions instead of ValuesAtPath for S3 field lookups. [#1401](https://github.com/aws/aws-sdk-go/pull/1401) - * Improves the performance across the board for all S3 API calls by removing the usage of `ValuesAtPath` being used for every S3 API call. - -### SDK Bugs -* `aws/request`: waiter test bug - * waiters_test.go file would sometimes fail due to travis hiccups. This occurs because a test would sometimes fail the cancel check and succeed the timeout. However, the timeout check should never occur in that test. This fix introduces a new field that dictates how waiters will sleep. -Release v1.10.12 (2017-07-17) -=== - -### Service Client Updates -* `service/cognito-idp`: Updates service API and documentation -* `service/lambda`: Updates service API and documentation - * Lambda@Edge lets you run code closer to your end users without provisioning or managing servers. With Lambda@Edge, your code runs in AWS edge locations, allowing you to respond to your end users at the lowest latency. Your code is triggered by Amazon CloudFront events, such as requests to and from origin servers and viewers, and it is ready to execute at every AWS edge location whenever a request for content is received. You just upload your Node.js code to AWS Lambda and Lambda takes care of everything required to run and scale your code with high availability. You only pay for the compute time you consume - there is no charge when your code is not running. - -Release v1.10.11 (2017-07-14) -=== - -### Service Client Updates -* `service/discovery`: Updates service API and documentation - * Adding feature to the Export API for Discovery Service to allow filters for the export task to allow export based on per agent id. -* `service/ec2`: Updates service API - * New EC2 GPU Graphics instance -* `service/marketplacecommerceanalytics`: Updates service documentation - * Update to Documentation Model For New Report Cadence / Reformat of Docs - -Release v1.10.10 (2017-07-13) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * Adds support for management of gateway responses. -* `service/ec2`: Updates service API and documentation - * X-ENI (or Cross-Account ENI) is a new feature that allows the attachment or association of Elastic Network Interfaces (ENI) between VPCs in different AWS accounts located in the same availability zone. With this new capability, service providers and partners can deliver managed solutions in a variety of new architectural patterns where the provider and consumer of the service are in different AWS accounts. -* `service/lex-models`: Updates service documentation - -Release v1.10.9 (2017-07-12) -=== - -### Service Client Updates -* `service/autoscaling`: Updates service API and documentation - * Auto Scaling now supports a new type of scaling policy called target tracking scaling policies that you can use to set up dynamic scaling for your application. -* `service/swf`: Updates service API, documentation, paginators, and examples - * Added support for attaching control data to Lambda tasks. Control data lets you attach arbitrary strings to your decisions and history events. - -Release v1.10.8 (2017-07-06) -=== - -### Service Client Updates -* `service/ds`: Updates service API, documentation, and paginators - * You can now improve the resilience and performance of your Microsoft AD directory by deploying additional domain controllers. Added UpdateNumberofDomainControllers API that allows you to update the number of domain controllers you want for your directory, and DescribeDomainControllers API that allows you to describe the detailed information of each domain controller of your directory. Also added the 'DesiredNumberOfDomainControllers' field to the DescribeDirectories API output for Microsoft AD. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/kinesis`: Updates service API and documentation - * You can now encrypt your data at rest within an Amazon Kinesis Stream using server-side encryption. Server-side encryption via AWS KMS makes it easy for customers to meet strict data management requirements by encrypting their data at rest within the Amazon Kinesis Streams, a fully managed real-time data processing service. -* `service/kms`: Updates service API and documentation - * This release of AWS Key Management Service introduces the ability to determine whether a key is AWS managed or customer managed. -* `service/ssm`: Updates service API and documentation - * Amazon EC2 Systems Manager now expands Patching support to Amazon Linux, Red Hat and Ubuntu in addition to the already supported Windows Server. - -Release v1.10.7 (2017-07-05) -=== - -### Service Client Updates -* `service/monitoring`: Updates service API and documentation - * We are excited to announce the availability of APIs and CloudFormation support for CloudWatch Dashboards. You can use the new dashboard APIs or CloudFormation templates to dynamically build and maintain dashboards to monitor your infrastructure and applications. There are four new dashboard APIs - PutDashboard, GetDashboard, DeleteDashboards, and ListDashboards APIs. PutDashboard is used to create a new dashboard or modify an existing one whereas GetDashboard is the API to get the details of a specific dashboard. ListDashboards and DeleteDashboards are used to get the names or delete multiple dashboards respectively. Getting started with dashboard APIs is similar to any other AWS APIs. The APIs can be accessed through AWS SDK or through CLI tools. -* `service/route53`: Updates service API and documentation - * Bug fix for InvalidChangeBatch exception. - -### SDK Enhancements -* `service/s3/s3manager`: adding cleanup function to batch objects [#1375](https://github.com/aws/aws-sdk-go/issues/1375) - * This enhancement will add an After field that will be called after each iteration of the batch operation. - -Release v1.10.6 (2017-06-30) -=== - -### Service Client Updates -* `service/marketplacecommerceanalytics`: Updates service documentation - * Documentation updates for AWS Marketplace Commerce Analytics. -* `service/s3`: Updates service API and documentation - * API Update for S3: Adding Object Tagging Header to MultipartUpload Initialization - -Release v1.10.5 (2017-06-29) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/events`: Updates service API and documentation - * CloudWatch Events now allows different AWS accounts to share events with each other through a new resource called event bus. Event buses accept events from AWS services, other AWS accounts and PutEvents API calls. Currently all AWS accounts have one default event bus. To send events to another account, customers simply write rules to match the events of interest and attach an event bus in the receiving account as the target to the rule. The PutTargets API has been updated to allow adding cross account event buses as targets. In addition, we have released two new APIs - PutPermission and RemovePermission - that enables customers to add/remove permissions to their default event bus. -* `service/gamelift`: Updates service API and documentation - * Allow developers to download GameLift fleet creation logs to assist with debugging. -* `service/ssm`: Updates service API and documentation - * Adding Resource Data Sync support to SSM Inventory. New APIs: * CreateResourceDataSync - creates a new resource data sync configuration, * ListResourceDataSync - lists existing resource data sync configurations, * DeleteResourceDataSync - deletes an existing resource data sync configuration. - -Release v1.10.4 (2017-06-27) -=== - -### Service Client Updates -* `service/servicecatalog`: Updates service API, documentation, and paginators - * Proper tagging of resources is critical to post-launch operations such as billing, cost allocation, and resource management. By using Service Catalog's TagOption Library, administrators can define a library of re-usable TagOptions that conform to company standards, and associate these with Service Catalog portfolios and products. Learn how to move your current tags to the new library, create new TagOptions, and view and associate your library items with portfolios and products. Understand how to ensure that the right tags are created on products launched through Service Catalog and how to provide users with defined selectable tags. - -### SDK Bugs -* `aws/signer/v4`: checking length on `stripExcessSpaces` [#1372](https://github.com/aws/aws-sdk-go/issues/1372) - * Fixes a bug where `stripExcessSpaces` did not check length against the slice. - * Fixes: [#1371](https://github.com/aws/aws-sdk-go/issues/1371) -Release v1.10.3 (2017-06-23) -=== - -### Service Client Updates -* `service/lambda`: Updates service API and documentation - * The Lambda Invoke API will now throw new exception InvalidRuntimeException (status code 502) for invokes with deprecated runtimes. - -Release v1.10.2 (2017-06-22) -=== - -### Service Client Updates -* `service/codepipeline`: Updates service API, documentation, and paginators - * A new API, ListPipelineExecutions, enables you to retrieve summary information about the most recent executions in a pipeline, including pipeline execution ID, status, start time, and last updated time. You can request information for a maximum of 100 executions. Pipeline execution data is available for the most recent 12 months of activity. -* `service/dms`: Updates service API and documentation - * Added tagging for DMS certificates. -* `service/elasticloadbalancing`: Updates service waiters -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lightsail`: Updates service API and documentation - * This release adds a new nextPageToken property to the result of the GetOperationsForResource API. Developers can now get the next set of items in a list by making subsequent calls to GetOperationsForResource API with the token from the previous call. This release also deprecates the nextPageCount property, which previously returned null (use the nextPageToken property instead). This release also deprecates the customImageName property on the CreateInstancesRequest class, which was previously ignored by the API. -* `service/route53`: Updates service API and documentation - * This release reintroduces the HealthCheckInUse exception. - -Release v1.10.1 (2017-06-21) -=== - -### Service Client Updates -* `service/dax`: Adds new service - * Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for DynamoDB that delivers up to a 10x performance improvement - from milliseconds to microseconds - even at millions of requests per second. DAX does all the heavy lifting required to add in-memory acceleration to your DynamoDB tables, without requiring developers to manage cache invalidation, data population, or cluster management. -* `service/route53`: Updates service API and documentation - * Amazon Route 53 now supports multivalue answers in response to DNS queries, which lets you route traffic approximately randomly to multiple resources, such as web servers. Create one multivalue answer record for each resource and, optionally, associate an Amazon Route 53 health check with each record, and Amazon Route 53 responds to DNS queries with up to eight healthy records. -* `service/ssm`: Updates service API, documentation, and paginators - * Adding hierarchy support to the SSM Parameter Store API. Added support tor tagging. New APIs: GetParameter - retrieves one parameter, DeleteParameters - deletes multiple parameters (max number 10), GetParametersByPath - retrieves parameters located in the hierarchy. Updated APIs: PutParameter - added ability to enforce parameter value by applying regex (AllowedPattern), DescribeParameters - modified to support Tag filtering. -* `service/waf`: Updates service API and documentation - * You can now create, edit, update, and delete a new type of WAF rule with a rate tracking component. -* `service/waf-regional`: Updates service API and documentation - -Release v1.10.0 (2017-06-20) -=== - -### Service Client Updates -* `service/workdocs`: Updates service API and documentation - * This release provides a new API to retrieve the activities performed by WorkDocs users. - -### SDK Features -* `aws/credentials/plugincreds`: Add support for Go plugin for credentials [#1320](https://github.com/aws/aws-sdk-go/pull/1320) - * Adds support for using plugins to retrieve credentials for API requests. This change adds a new package plugincreds under aws/credentials. See the `example/aws/credentials/plugincreds` folder in the SDK for example usage. - -Release v1.9.00 (2017-06-19) -=== - -### Service Client Updates -* `service/organizations`: Updates service API and documentation - * Improvements to Exception Modeling - -### SDK Features -* `service/s3/s3manager`: Adds batch operations to s3manager [#1333](https://github.com/aws/aws-sdk-go/pull/1333) - * Allows for batch upload, download, and delete of objects. Also adds the interface pattern to allow for easy traversal of objects. E.G `DownloadWithIterator`, `UploadWithIterator`, and `BatchDelete`. `BatchDelete` also contains a utility iterator using the `ListObjects` API to easily delete a list of objects. - -Release v1.8.44 (2017-06-16) -=== - -### Service Client Updates -* `service/xray`: Updates service API, documentation, and paginators - * Add a response time histogram to the services in response of GetServiceGraph API. - -Release v1.8.43 (2017-06-15) -=== - -### Service Client Updates -* `service/ec2`: Updates service API and documentation - * Adds API to describe Amazon FPGA Images (AFIs) available to customers, which includes public AFIs, private AFIs that you own, and AFIs owned by other AWS accounts for which you have load permissions. -* `service/ecs`: Updates service API and documentation - * Added support for cpu, memory, and memory reservation container overrides on the RunTask and StartTask APIs. -* `service/iot`: Updates service API and documentation - * Revert the last release: remove CertificatePem from DescribeCertificate API. -* `service/servicecatalog`: Updates service API, documentation, and paginators - * Added ProvisioningArtifactSummaries to DescribeProductAsAdmin's output to show the provisioning artifacts belong to the product. Allow filtering by SourceProductId in SearchProductsAsAdmin for AWS Marketplace products. Added a verbose option to DescribeProvisioningArtifact to display the CloudFormation template used to create the provisioning artifact.Added DescribeProvisionedProduct API. Changed the type of ProvisionedProduct's Status to be distinct from Record's Status. New ProvisionedProduct's Status are AVAILABLE, UNDER_CHANGE, TAINTED, ERROR. Changed Record's Status set of values to CREATED, IN_PROGRESS, IN_PROGRESS_IN_ERROR, SUCCEEDED, FAILED. - -### SDK Bugs -* `private/model/api`: Fix RESTXML support for XML Namespace [#1343](https://github.com/aws/aws-sdk-go/pull/1343) - * Fixes a bug with the SDK's generation of services using the REST XML protocol not annotating shape references with the XML Namespace attribute. - * Fixes [#1334](https://github.com/aws/aws-sdk-go/pull/1334) -Release v1.8.42 (2017-06-14) -=== - -### Service Client Updates -* `service/applicationautoscaling`: Updates service API and documentation -* `service/clouddirectory`: Updates service documentation - * Documentation update for Cloud Directory - -Release v1.8.41 (2017-06-13) -=== - -### Service Client Updates -* `service/configservice`: Updates service API - -Release v1.8.40 (2017-06-13) -=== - -### Service Client Updates -* `service/rds`: Updates service API and documentation - * API Update for RDS: this update enables copy-on-write, a new Aurora MySQL Compatible Edition feature that allows users to restore their database, and support copy of TDE enabled snapshot cross region. - -### SDK Bugs -* `aws/request`: Fix NewErrParamMinLen to use correct ParamMinLenErrCode [#1336](https://github.com/aws/aws-sdk-go/issues/1336) - * Fixes the `NewErrParamMinLen` function returning the wrong error code. `ParamMinLenErrCode` should be returned not `ParamMinValueErrCode`. - * Fixes [#1335](https://github.com/aws/aws-sdk-go/issues/1335) -Release v1.8.39 (2017-06-09) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/opsworks`: Updates service API and documentation - * Tagging Support for AWS OpsWorks Stacks - -Release v1.8.38 (2017-06-08) -=== - -### Service Client Updates -* `service/iot`: Updates service API and documentation - * In addition to using certificate ID, AWS IoT customers can now obtain the description of a certificate with the certificate PEM. -* `service/pinpoint`: Updates service API and documentation - * Starting today Amazon Pinpoint adds SMS Text and Email Messaging support in addition to Mobile Push Notifications, providing developers, product managers and marketers with multi-channel messaging capabilities to drive user engagement in their applications. Pinpoint also enables backend services and applications to message users directly and provides advanced user and app analytics to understand user behavior and messaging performance. -* `service/rekognition`: Updates service API and documentation - * API Update for AmazonRekognition: Adding RecognizeCelebrities API - -Release v1.8.37 (2017-06-07) -=== - -### Service Client Updates -* `service/codebuild`: Updates service API and documentation - * Add support to APIs for privileged containers. This change would allow performing privileged operations like starting the Docker daemon inside builds possible in custom docker images. -* `service/greengrass`: Adds new service - * AWS Greengrass is software that lets you run local compute, messaging, and device state synchronization for connected devices in a secure way. With AWS Greengrass, connected devices can run AWS Lambda functions, keep device data in sync, and communicate with other devices securely even when not connected to the Internet. Using AWS Lambda, Greengrass ensures your IoT devices can respond quickly to local events, operate with intermittent connections, and minimize the cost of transmitting IoT data to the cloud. - -Release v1.8.36 (2017-06-06) -=== - -### Service Client Updates -* `service/acm`: Updates service documentation - * Documentation update for AWS Certificate Manager. -* `service/cloudfront`: Updates service documentation - * Doc update to fix incorrect prefix in S3OriginConfig -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/iot`: Updates service API - * Update client side validation for SalesForce action. - -Release v1.8.35 (2017-06-05) -=== - -### Service Client Updates -* `service/appstream`: Updates service API and documentation - * AppStream 2.0 Custom Security Groups allows you to easily control what network resources your streaming instances and images have access to. You can assign up to 5 security groups per Fleet to control the inbound and outbound network access to your streaming instances to specific IP ranges, network protocols, or ports. -* `service/iot`: Updates service API, documentation, paginators, and examples - * Added Salesforce action to IoT Rules Engine. - -Release v1.8.34 (2017-06-02) -=== - -### Service Client Updates -* `service/kinesisanalytics`: Updates service API, documentation, and paginators - * Kinesis Analytics publishes error messages CloudWatch logs in case of application misconfigurations -* `service/workdocs`: Updates service API and documentation - * This release includes new APIs to manage tags and custom metadata on resources and also new APIs to add and retrieve comments at the document level. - -Release v1.8.33 (2017-06-01) -=== - -### Service Client Updates -* `service/codedeploy`: Updates service API and documentation - * AWS CodeDeploy has improved how it manages connections to GitHub accounts and repositories. You can now create and store up to 25 connections to GitHub accounts in order to associate AWS CodeDeploy applications with GitHub repositories. Each connection can support multiple repositories. You can create connections to up to 25 different GitHub accounts, or create more than one connection to a single account. The ListGitHubAccountTokenNames command has been introduced to retrieve the names of stored connections to GitHub accounts that you have created. The name of the connection to GitHub used for an AWS CodeDeploy application is also included in the ApplicationInfo structure. Two new fields, lastAttemptedDeployment and lastSuccessfulDeployment, have been added to DeploymentGroupInfo to improve the handling of deployment group information in the AWS CodeDeploy console. Information about these latest deployments can also be retrieved using the GetDeploymentGroup and BatchGetDeployment group requests. Also includes a region update (us-gov-west-1). -* `service/cognitoidentityprovider`: Updates service API, documentation, and paginators -* `service/elbv2`: Updates service API and documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lexmodelbuildingservice`: Updates service documentation and examples - -### SDK Enhancements -* `aws/defaults`: Exports shared credentials and config default filenames used by the SDK. [#1308](https://github.com/aws/aws-sdk-go/pull/1308) - * Adds SharedCredentialsFilename and SharedConfigFilename functions to defaults package. - -### SDK Bugs -* `aws/credentials`: Fixes shared credential provider's default filename on Windows. [#1308](https://github.com/aws/aws-sdk-go/pull/1308) - * The shared credentials provider would attempt to use the wrong filename on Windows if the `HOME` environment variable was defined. -* `service/s3/s3manager`: service/s3/s3manager: Fix Downloader ignoring Range get parameter [#1311](https://github.com/aws/aws-sdk-go/pull/1311) - * Fixes the S3 Download Manager ignoring the GetObjectInput's Range parameter. If this parameter is provided it will force the downloader to fallback to a single GetObject request disabling concurrency and automatic part size gets. - * Fixes [#1296](https://github.com/aws/aws-sdk-go/issues/1296) -Release v1.8.32 (2017-05-31) -=== - -### Service Client Updates -* `service/rds`: Updates service API and documentation - * Amazon RDS customers can now easily and quickly stop and start their DB instances. - -Release v1.8.31 (2017-05-30) -=== - -### Service Client Updates -* `service/clouddirectory`: Updates service API, documentation, and paginators - * Cloud Directory has launched support for Typed Links, enabling customers to create object-to-object relationships that are not hierarchical in nature. Typed Links enable customers to quickly query for data along these relationships. Customers can also enforce referential integrity using Typed Links, ensuring data in use is not inadvertently deleted. -* `service/s3`: Updates service paginators and examples - * New example snippets for Amazon S3. - -Release v1.8.30 (2017-05-25) -=== - -### Service Client Updates -* `service/appstream`: Updates service API and documentation - * Support added for persistent user storage, backed by S3. -* `service/rekognition`: Updates service API and documentation - * Updated the CompareFaces API response to include orientation information, unmatched faces, landmarks, pose, and quality of the compared faces. - -Release v1.8.29 (2017-05-24) -=== - -### Service Client Updates -* `service/iam`: Updates service API - * The unique ID and access key lengths were extended from 32 to 128 -* `service/storagegateway`: Updates service API and documentation - * Two Storage Gateway data types, Tape and TapeArchive, each have a new response element, TapeUsedInBytes. This element helps you manage your virtual tapes. By using TapeUsedInBytes, you can see the amount of data written to each virtual tape. -* `service/sts`: Updates service API, documentation, and paginators - * The unique ID and access key lengths were extended from 32 to 128. - -Release v1.8.28 (2017-05-23) -=== - -### Service Client Updates -* `service/databasemigrationservice`: Updates service API, documentation, paginators, and examples - * This release adds support for using Amazon S3 and Amazon DynamoDB as targets for database migration, and using MongoDB as a source for database migration. For more information, see the AWS Database Migration Service documentation. - -Release v1.8.27 (2017-05-22) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/resourcegroupstaggingapi`: Updates service API, documentation, and paginators - * You can now specify the number of resources returned per page in GetResources operation, as an optional parameter, to easily manage the list of resources returned by your queries. - -### SDK Bugs -* `aws/request`: Add support for PUT temporary redirects (307) [#1283](https://github.com/aws/aws-sdk-go/issues/1283) - * Adds support for Go 1.8's GetBody function allowing the SDK's http request using PUT and POST methods to be redirected with temporary redirects with 307 status code. - * Fixes: [#1267](https://github.com/aws/aws-sdk-go/issues/1267) -* `aws/request`: Add handling for retrying temporary errors during unmarshal [#1289](https://github.com/aws/aws-sdk-go/issues/1289) - * Adds support for retrying temporary errors that occur during unmarshaling of a request's response body. - * Fixes: [#1275](https://github.com/aws/aws-sdk-go/issues/1275) -Release v1.8.26 (2017-05-18) -=== - -### Service Client Updates -* `service/athena`: Adds new service - * This release adds support for Amazon Athena. Amazon Athena is an interactive query service that makes it easy to analyze data in Amazon S3 using standard SQL. Athena is serverless, so there is no infrastructure to manage, and you pay only for the queries that you run. -* `service/lightsail`: Updates service API, documentation, and paginators - * This release adds new APIs that make it easier to set network port configurations on Lightsail instances. Developers can now make a single request to both open and close public ports on an instance using the PutInstancePublicPorts operation. - -### SDK Bugs -* `aws/request`: Fix logging from reporting wrong retry request errors #1281 - * Fixes the SDK's retry request logging to report the the actual error that occurred, not a stubbed Unknown error message. - * Fixes the SDK's response logger to not output the response log multiple times per retry. -Release v1.8.25 (2017-05-17) -=== - -### Service Client Updates -* `service/autoscaling`: Updates service documentation, paginators, and examples - * Various Auto Scaling documentation updates -* `service/cloudwatchevents`: Updates service documentation - * Various CloudWatch Events documentation updates. -* `service/cloudwatchlogs`: Updates service documentation and paginators - * Various CloudWatch Logs documentation updates. -* `service/polly`: Updates service API - * Amazon Polly adds new German voice "Vicki" - -Release v1.8.24 (2017-05-16) -=== - -### Service Client Updates -* `service/codedeploy`: Updates service API and documentation - * This release introduces the previousRevision field in the responses to the GetDeployment and BatchGetDeployments actions. previousRevision provides information about the application revision that was deployed to the deployment group before the most recent successful deployment. Also, the fileExistsBehavior parameter has been added for CreateDeployment action requests. In the past, if the AWS CodeDeploy agent detected files in a target location that weren't part of the application revision from the most recent successful deployment, it would fail the current deployment by default. This new parameter provides options for how the agent handles these files: fail the deployment, retain the content, or overwrite the content. -* `service/gamelift`: Updates service API and documentation - * Allow developers to specify how metrics are grouped in CloudWatch for their GameLift fleets. Developers can also specify how many concurrent game sessions activate on a per-instance basis. -* `service/inspector`: Updates service API, documentation, paginators, and examples - * Adds ability to produce an assessment report that includes detailed and comprehensive results of a specified assessment run. -* `service/kms`: Updates service documentation - * Update documentation for KMS. - -Release v1.8.23 (2017-05-15) -=== - -### Service Client Updates -* `service/ssm`: Updates service API and documentation - * UpdateAssociation API now supports updating document name and targets of an association. GetAutomationExecution API can return FailureDetails as an optional field to the StepExecution Object, which contains failure type, failure stage as well as other failure related information for a failed step. - -### SDK Enhancements -* `aws/session`: SDK should be able to load multiple custom shared config files. [#1258](https://github.com/aws/aws-sdk-go/issues/1258) - * This change adds a `SharedConfigFiles` field to the `session.Options` type that allows you to specify the files, and their order, the SDK will use for loading shared configuration and credentials from when the `Session` is created. Use the `NewSessionWithOptions` Session constructor to specify these options. You'll also most likely want to enable support for the shared configuration file's additional attributes by setting `session.Option`'s `SharedConfigState` to `session.SharedConfigEnabled`. - -Release v1.8.22 (2017-05-11) -=== - -### Service Client Updates -* `service/elb`: Updates service API, documentation, and paginators -* `service/elbv2`: Updates service API and documentation -* `service/lexmodelbuildingservice`: Updates service API and documentation -* `service/organizations`: Updates service API, documentation, paginators, and examples - * AWS Organizations APIs that return an Account object now include the email address associated with the account’s root user. - -Release v1.8.21 (2017-05-09) -=== - -### Service Client Updates -* `service/codestar`: Updates service documentation - * Updated documentation for AWS CodeStar. -* `service/workspaces`: Updates service API, documentation, and paginators - * Doc-only Update for WorkSpaces - -Release v1.8.20 (2017-05-04) -=== - -### Service Client Updates -* `service/ecs`: Updates service API, documentation, and paginators - * Exposes container instance registration time in ECS:DescribeContainerInstances. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/marketplaceentitlementservice`: Adds new service -* `service/lambda`: Updates service API and documentation - * Support for UpdateFunctionCode DryRun option - -Release v1.8.19 (2017-04-28) -=== - -### Service Client Updates -* `service/cloudformation`: Updates service waiters and paginators - * Adding back the removed waiters and paginators. - -Release v1.8.18 (2017-04-28) -=== - -### Service Client Updates -* `service/cloudformation`: Updates service API, documentation, waiters, paginators, and examples - * API update for CloudFormation: New optional parameter ClientRequestToken which can be used as an idempotency token to safely retry certain operations as well as tagging StackEvents. -* `service/rds`: Updates service API, documentation, and examples - * The DescribeDBClusterSnapshots API now returns a SourceDBClusterSnapshotArn field which identifies the source DB cluster snapshot of a copied snapshot. -* `service/rekognition`: Updates service API - * Fix for missing file type check -* `service/snowball`: Updates service API, documentation, and paginators - * The Snowball API has a new exception that can be thrown for list operation requests. -* `service/sqs`: Updates service API, documentation, and paginators - * Adding server-side encryption (SSE) support to SQS by integrating with AWS KMS; adding new queue attributes to SQS CreateQueue, SetQueueAttributes and GetQueueAttributes APIs to support SSE. - -Release v1.8.17 (2017-04-26) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rds`: Updates service API and documentation - * With Amazon Relational Database Service (Amazon RDS) running MySQL or Amazon Aurora, you can now authenticate to your DB instance using IAM database authentication. - -Release v1.8.16 (2017-04-21) -=== - -### Service Client Updates -* `service/appstream`: Updates service API, documentation, and paginators - * The new feature named "Default Internet Access" will enable Internet access from AppStream 2.0 instances - image builders and fleet instances. Admins will check a flag either through AWS management console for AppStream 2.0 or through API while creating an image builder or while creating/updating a fleet. -* `service/kinesis`: Updates service API, documentation, waiters, and paginators - * Adds a new waiter, StreamNotExists, to Kinesis. - -### SDK Enhancements -* `aws/endpoints`: Add utilities improving endpoints lookup (#1218) - * Adds several utilities to the endpoints packages to make looking up partitions, regions, and services easier. - * Fixes #994 - -### SDK Bugs -* `private/protocol/xml/xmlutil`: Fix unmarshaling dropping errors (#1219) - * The XML unmarshaler would drop any serialization or body read error that occurred on the floor effectively hiding any errors that would occur. - * Fixes #1205 -Release v1.8.15 (2017-04-20) -=== - -### Service Client Updates -* `service/devicefarm`: Updates service API and documentation - * API Update for AWS Device Farm: Support for Deals and Promotions -* `service/directconnect`: Updates service documentation - * Documentation updates for AWS Direct Connect. -* `service/elbv2`: Updates service waiters -* `service/kms`: Updates service documentation and examples - * Doc-only update for Key Management Service (KMS): Update docs for GrantConstraints and GenerateRandom -* `service/route53`: Updates service documentation - * Release notes: SDK documentation now includes examples for ChangeResourceRecordSets for all types of resource record set, such as weighted, alias, and failover. -* `service/route53domains`: Updates service API, documentation, and paginators - * Adding examples and other documentation updates. - -### SDK Enhancements -* `service/s3`: Add utilities to make getting a bucket's region easier (#1207) - * Adds two features which make it easier to get a bucket's region, `s3.NormalizeBucketLocation` and `s3manager.GetBucketRegion`. - -### SDK Bugs -* `service/s3`: Fix HeadObject's incorrect documented error codes (#1213) - * The HeadObject's model incorrectly states that the operation can return the NoSuchKey error code. - * Fixes #1208 - -Release v1.8.14 (2017-04-19) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * Add support for "embed" property. -* `service/codestar`: Adds new service - * AWS CodeStar is a cloud-based service for creating, managing, and working with software development projects on AWS. An AWS CodeStar project creates and integrates AWS services for your project development toolchain. AWS CodeStar also manages the permissions required for project users. -* `service/ec2`: Updates service API and documentation - * Adds support for creating an Amazon FPGA Image (AFI) from a specified design checkpoint (DCP). -* `service/iam`: Updates service API and documentation - * This changes introduces a new IAM role type, Service Linked Role, which works like a normal role but must be managed via services' control. -* `service/lambda`: Updates service API and documentation - * Lambda integration with CloudDebugger service to enable customers to enable tracing for the Lambda functions and send trace information to the CloudDebugger service. -* `service/lexmodelbuildingservice`: Adds new service -* `service/polly`: Updates service API, documentation, and paginators - * API Update for Amazon Polly: Add support for speech marks -* `service/rekognition`: Updates service API and documentation - * Given an image, the API detects explicit or suggestive adult content in the image and returns a list of corresponding labels with confidence scores, as well as a taxonomy (parent-child relation) for each label. - -Release v1.8.13 (2017-04-18) -=== - -### Service Client Updates -* `service/lambda`: Updates service API and documentation - * You can use tags to group and filter your Lambda functions, making it easier to analyze them for billing allocation purposes. For more information, see Tagging Lambda Functions. You can now write or upgrade your Lambda functions using Python version 3.6. For more information, see Programming Model for Authoring Lambda Functions in Python. Note: Features will be rolled out in the US regions on 4/19. - -### SDK Enhancements -* `aws/request`: add support for appengine's custom standard library (#1190) - * Remove syscall error checking on appengine platforms. - -Release v1.8.12 (2017-04-11) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * API Gateway request validators -* `service/batch`: Updates service API and documentation - * API Update for AWS Batch: Customer provided AMI for MANAGED Compute Environment -* `service/gamelift`: Updates service API and documentation - * Allows developers to utilize an improved workflow when calling our Queues API and introduces a new feature that allows developers to specify a maximum allowable latency per Queue. -* `service/opsworks`: Updates service API, documentation, and paginators - * Cloudwatch Logs agent configuration can now be attached to OpsWorks Layers using CreateLayer and UpdateLayer. OpsWorks will then automatically install and manage the CloudWatch Logs agent on the instances part of the OpsWorks Layer. - -### SDK Bugs -* `aws/client`: Fix clients polluting handler list (#1197) - * Fixes the clients potentially polluting the passed in handler list with the client's customizations. This change ensures every client always works with a clean copy of the request handlers and it cannot pollute the handlers back upstream. - * Fixes #1184 -* `aws/request`: Fix waiter error match condition (#1195) - * Fixes the waiters's matching overwriting the request's err, effectively ignoring the error condition. This broke waiters with the FailureWaiterState matcher state. -Release v1.8.11 (2017-04-07) -=== - -### Service Client Updates -* `service/redshift`: Updates service API, documentation, and paginators - * This update adds the GetClusterCredentials API which is used to get temporary login credentials to the cluster. AccountWithRestoreAccess now has a new member AccountAlias, this is the identifier of the AWS support account authorized to restore the specified snapshot. This is added to support the feature where the customer can share their snapshot with the Amazon Redshift Support Account without having to manually specify the AWS Redshift Service account ID on the AWS Console/API. - -Release v1.8.10 (2017-04-06) -=== - -### Service Client Updates -* `service/elbv2`: Updates service documentation - -Release v1.8.9 (2017-04-05) -=== - -### Service Client Updates -* `service/elasticache`: Updates service API, documentation, paginators, and examples - * ElastiCache added support for testing the Elasticache Multi-AZ feature with Automatic Failover. - -Release v1.8.8 (2017-04-04) -=== - -### Service Client Updates -* `service/cloudwatch`: Updates service API, documentation, and paginators - * Amazon Web Services announced the immediate availability of two additional alarm configuration rules for Amazon CloudWatch Alarms. The first rule is for configuring missing data treatment. Customers have the options to treat missing data as alarm threshold breached, alarm threshold not breached, maintain alarm state and the current default treatment. The second rule is for alarms based on percentiles metrics that can trigger unnecassarily if the percentile is calculated from a small number of samples. The new rule can treat percentiles with low sample counts as same as missing data. If the first rule is enabled, the same treatment will be applied when an alarm encounters a percentile with low sample counts. - -Release v1.8.7 (2017-04-03) -=== - -### Service Client Updates -* `service/lexruntimeservice`: Updates service API and documentation - * Adds support to PostContent for speech input - -### SDK Enhancements -* `aws/request`: Improve handler copy, push back, push front performance (#1171) - * Minor optimization to the handler list's handling of copying and pushing request handlers to the handler list. -* Update codegen header to use Go std wording (#1172) - * Go recently accepted the proposal for standard generated file header wording in, https://golang.org/s/generatedcode. - -### SDK Bugs -* `service/dynamodb`: Fix DynamoDB using custom retryer (#1170) - * Fixes (#1139) the DynamoDB service client clobbering any custom retryer that was passed into the service client or Session's config. -Release v1.8.6 (2017-04-01) -=== - -### Service Client Updates -* `service/clouddirectory`: Updates service API and documentation - * ListObjectAttributes now supports filtering by facet. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.8.5 (2017-03-30) -=== - -### Service Client Updates -* `service/cloudformation`: Updates service waiters and paginators - * Adding paginators for ListExports and ListImports -* `service/cloudfront`: Adds new service - * Amazon CloudFront now supports user configurable HTTP Read and Keep-Alive Idle Timeouts for your Custom Origin Servers -* `service/configservice`: Updates service documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/resourcegroupstaggingapi`: Adds new service -* `service/storagegateway`: Updates service API and documentation - * File gateway mode in AWS Storage gateway provides access to objects in S3 as files on a Network File System (NFS) mount point. Once a file share is created, any changes made externally to the S3 bucket will not be reflected by the gateway. Using the cache refresh feature in this update, the customer can trigger an on-demand scan of the keys in their S3 bucket and refresh the file namespace cached on the gateway. It takes as an input the fileShare ARN and refreshes the cache for only that file share. Additionally there is new functionality on file gateway that allows you configure what squash options they would like on their file share, this allows a customer to configure their gateway to not squash root permissions. This can be done by setting options in NfsOptions for CreateNfsFileShare and UpdateNfsFileShare APIs. - -Release v1.8.4 (2017-03-28) -=== - -### Service Client Updates -* `service/batch`: Updates service API, documentation, and paginators - * Customers can now provide a retryStrategy as part of the RegisterJobDefinition and SubmitJob API calls. The retryStrategy object has a number value for attempts. This is the number of non successful executions before a job is considered FAILED. In addition, the JobDetail object now has an attempts field and shows all execution attempts. -* `service/ec2`: Updates service API and documentation - * Customers can now tag their Amazon EC2 Instances and Amazon EBS Volumes at - the time of their creation. You can do this from the EC2 Instance launch - wizard or through the RunInstances or CreateVolume APIs. By tagging - resources at the time of creation, you can eliminate the need to run custom - tagging scripts after resource creation. In addition, you can now set - resource-level permissions on the CreateVolume, CreateTags, DeleteTags, and - the RunInstances APIs. This allows you to implement stronger security - policies by giving you more granular control over which users and groups - have access to these APIs. You can also enforce the use of tagging and - control what tag keys and values are set on your resources. When you combine - tag usage and resource-level IAM policies together, you can ensure your - instances and volumes are properly secured upon creation and achieve more - accurate cost allocation reporting. These new features are provided at no - additional cost. - -### SDK Enhancements -* `aws/request`: Add retry support for RequestTimeoutException (#1158) - * Adds support for retrying RequestTimeoutException error code that is returned by some services. - -### SDK Bugs -* `private/model/api`: Fix Waiter and Paginators panic on nil param inputs (#1157) - * Corrects the code generation for Paginators and waiters that caused a panic if nil input parameters were used with the operations. -Release v1.8.3 (2017-03-27) -=== - -## Service Client Updates -* `service/ssm`: Updates service API, documentation, and paginators - * Updated validation rules for SendCommand and RegisterTaskWithMaintenanceWindow APIs. -Release v1.8.2 (2017-03-24) -=== - -Service Client Updates ---- -* `service/applicationautoscaling`: Updates service API, documentation, and paginators - * Application AutoScaling is launching support for a new target resource (AppStream 2.0 Fleets) as a scalable target. -* `service/cloudtrail`: Updates service API and documentation - * Doc-only Update for CloudTrail: Add required parameters for GetEventSelectors and PutEventSelectors - -Release v1.8.1 (2017-03-23) -=== - -Service Client Updates ---- -* `service/applicationdiscoveryservice`: Updates service API, documentation, and paginators - * Adds export configuration options to the AWS Discovery Service API. -* `service/elbv2`: Updates waiters -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lambda`: Updates service API and paginators - * Adds support for new runtime Node.js v6.10 for AWS Lambda service - -Release v1.8.0 (2017-03-22) -=== - -Service Client Updates ---- -* `service/codebuild`: Updates service documentation -* `service/directconnect`: Updates service API - * Deprecated DescribeConnectionLoa, DescribeInterconnectLoa, AllocateConnectionOnInterconnect and DescribeConnectionsOnInterconnect operations in favor of DescribeLoa, DescribeLoa, AllocateHostedConnection and DescribeHostedConnections respectively. -* `service/marketplacecommerceanalytics`: Updates service API, documentation, and paginators - * This update adds a new data set, us_sales_and_use_tax_records, which enables AWS Marketplace sellers to programmatically access to their U.S. Sales and Use Tax report data. -* `service/pinpoint`: Updates service API and documentation - * Amazon Pinpoint User Segmentation - * Added ability to segment endpoints by user attributes in addition to endpoint attributes. Amazon Pinpoint Event Stream Preview - * Added functionality to publish raw app analytics and campaign events data as events streams to Kinesis and Kinesis Firehose - * The feature provides developers with increased flexibility of exporting raw events to S3, Redshift, Elasticsearch using a Kinesis Firehose stream or enable real time event processing use cases using a Kinesis stream -* `service/rekognition`: Updates service documentation. - -SDK Features ---- -* `aws/request`: Add support for context.Context to SDK API operation requests (#1132) - * Adds support for context.Context to the SDK by adding `WithContext` methods for each API operation, Paginators and Waiters. e.g `PutObjectWithContext`. This change also adds the ability to provide request functional options to the method calls instead of requiring you to use the `Request` API operation method (e.g `PutObjectRequest`). - * Adds a `Complete` Request handler list that will be called ever time a request is completed. This includes both success and failure. Complete will only be called once per API operation request. - * `private/waiter` package moved from the private group to `aws/request/waiter` and made publicly available. - * Adds Context support to all API operations, Waiters(WaitUntil) and Paginators(Pages) methods. - * Adds Context support for s3manager and s3crypto clients. - -SDK Enhancements ---- -* `aws/signer/v4`: Adds support for unsigned payload signer config (#1130) - * Adds configuration option to the v4.Signer to specify the request's body should not be signed. This will only correclty function on services that support unsigned payload. e.g. S3, Glacier. - -SDK Bug Fixes ---- -* `service/s3`: Fix S3 HostID to be available in S3 request error message (#1131) - * Adds a new type s3.RequestFailure which exposes the S3 HostID value from a S3 API operation response. This is helpful when you have an error with S3, and need to contact support. Both RequestID and HostID are needed. -* `private/model/api`: Do not return a link if uid is empty (#1133) - * Fixes SDK's doc generation to not generate API reference doc links if the SDK us unable to create a valid link. -* `aws/request`: Optimization to handler list copy to prevent multiple alloc calls. (#1134) -Release v1.7.9 (2017-03-13) -=== - -Service Client Updates ---- -* `service/devicefarm`: Updates service API, documentation, paginators, and examples - * Network shaping allows users to simulate network connections and conditions while testing their Android, iOS, and web apps with AWS Device Farm. -* `service/cloudwatchevents`: Updates service API, documentation, and examples - -SDK Enhancement -=== -* `aws/session`: Add support for side loaded CA bundles (#1117) - * Adds supports for side loading Certificate Authority bundle files to the SDK using AWS_CA_BUNDLE environment variable or CustomCABundle session option. -* `service/s3/s3crypto`: Add support for AES/CBC/PKCS5Padding (#1124) - -SDK Bug -=== -* `service/rds`: Fixing issue when not providing `SourceRegion` on cross -region operations (#1127) -* `service/rds`: Enables cross region for `CopyDBClusterSnapshot` and -`CreateDBCluster` (#1128) - -Release v1.7.8 (2017-03-10) -=== - -Service Client Updates ---- -* `service/codedeploy`: Updates service paginators - * Add paginators for Codedeploy -* `service/emr`: Updates service API, documentation, and paginators - * This release includes support for instance fleets in Amazon EMR. - -Release v1.7.7 (2017-03-09) -=== - -Service Client Updates ---- -* `service/apigateway`: Updates service API, documentation, and paginators - * API Gateway has added support for ACM certificates on custom domain names. Both Amazon-issued certificates and uploaded third-part certificates are supported. -* `service/clouddirectory`: Updates service API, documentation, and paginators - * Introduces a new Cloud Directory API that enables you to retrieve all available parent paths for any type of object (a node, leaf node, policy node, and index node) in a hierarchy. - -Release v1.7.6 (2017-03-09) -=== - -Service Client Updates ---- -* `service/organizations`: Updates service documentation and examples - * Doc-only Update for Organizations: Add SDK Code Snippets -* `service/workdocs`: Adds new service - * The Administrative SDKs for Amazon WorkDocs provides full administrator level access to WorkDocs site resources, allowing developers to integrate their applications to manage WorkDocs users, content and permissions programmatically - -Release v1.7.5 (2017-03-08) -=== - -Service Client Updates ---- -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rds`: Updates service API and documentation - * Add support to using encrypted clusters as cross-region replication masters. Update CopyDBClusterSnapshot API to support encrypted cross region copy of Aurora cluster snapshots. - -Release v1.7.4 (2017-03-06) -=== - -Service Client Updates ---- -* `service/budgets`: Updates service API and paginators - * When creating or editing a budget via the AWS Budgets API you can define notifications that are sent to subscribers when the actual or forecasted value for cost or usage exceeds the notificationThreshold associated with the budget notification object. Starting today, the maximum allowed value for the notificationThreshold was raised from 100 to 300. This change was made to give you more flexibility when setting budget notifications. -* `service/cloudtrail`: Updates service documentation and paginators - * Doc-only update for AWSCloudTrail: Updated links/descriptions -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/opsworkscm`: Updates service API, documentation, and paginators - * OpsWorks for Chef Automate has added a new field "AssociatePublicIpAddress" to the CreateServer request, "CloudFormationStackArn" to the Server model and "TERMINATED" server state. - - -Release v1.7.3 (2017-02-28) -=== - -Service Client Updates ---- -* `service/mturk`: Renaming service - * service/mechanicalturkrequesterservice was renamed to service/mturk. Be sure to change any references of the old client to the new. - -Release v1.7.2 (2017-02-28) -=== - -Service Client Updates ---- -* `service/dynamodb`: Updates service API and documentation - * Release notes: Time to Live (TTL) is a feature that allows you to define when items in a table expire and can be purged from the database, so that you don't have to track expired data and delete it manually. With TTL enabled on a DynamoDB table, you can set a timestamp for deletion on a per-item basis, allowing you to limit storage usage to only those records that are relevant. -* `service/iam`: Updates service API, documentation, and paginators - * This release adds support for AWS Organizations service control policies (SCPs) to SimulatePrincipalPolicy operation. If there are SCPs associated with the simulated user's account, their effect on the result is captured in the OrganizationDecisionDetail element in the EvaluationResult. -* `service/mechanicalturkrequesterservice`: Adds new service - * Amazon Mechanical Turk is a web service that provides an on-demand, scalable, human workforce to complete jobs that humans can do better than computers, for example, recognizing objects in photos. -* `service/organizations`: Adds new service - * AWS Organizations is a web service that enables you to consolidate your multiple AWS accounts into an organization and centrally manage your accounts and their resources. -* `service/dynamodbstreams`: Updates service API, documentation, and paginators -* `service/waf`: Updates service API, documentation, and paginators - * Aws WAF - For GetSampledRequests action, changed max number of samples from 100 to 500. -* `service/wafregional`: Updates service API, documentation, and paginators - -Release v1.7.1 (2017-02-24) -=== - -Service Client Updates ---- -* `service/elasticsearchservice`: Updates service API, documentation, paginators, and examples - * Added three new API calls to existing Amazon Elasticsearch service to expose Amazon Elasticsearch imposed limits to customers. - -Release v1.7.0 (2017-02-23) -=== - -Service Client Updates ---- -* `service/ec2`: Updates service API - * New EC2 I3 instance type - -SDK Bug ---- -* `service/s3/s3manager`: Adding support for SSE (#1097) - * Fixes SSE fields not being applied to a part during multi part upload. - -SDK Feature ---- -* `aws/session`: Add support for AssumeRoles with MFA (#1088) - * Adds support for assuming IAM roles with MFA enabled. A TokenProvider func was added to stscreds.AssumeRoleProvider that will be called each time the role's credentials need to be refreshed. A basic token provider that sources the MFA token from stdin as stscreds.StdinTokenProvider. -* `aws/session`: Update SDK examples and docs to use session.Must (#1099) - * Updates the SDK's example and docs to use session.Must where possible to highlight its usage as apposed to session error checking that is most cases errors will be terminal to the application anyways. -Release v1.6.27 (2017-02-22) -=== - -Service Client Updates ---- -* `service/clouddirectory`: Updates service documentation - * ListObjectAttributes documentation updated based on forum feedback -* `service/elasticbeanstalk`: Updates service API, documentation, and paginators - * Elastic Beanstalk adds support for creating and managing custom platform. -* `service/gamelift`: Updates service API, documentation, and paginators - * Allow developers to configure global queues for creating GameSessions. Allow PlayerData on PlayerSessions to store player-specific data. -* `service/route53`: Updates service API, documentation, and examples - * Added support for operations CreateVPCAssociationAuthorization and DeleteVPCAssociationAuthorization to throw a ConcurrentModification error when a conflicting modification occurs in parallel to the authorizations in place for a given hosted zone. - -Release v1.6.26 (2017-02-21) -=== - -Service Client Updates ---- -* `service/ec2`: Updates service API and documentation - * Added the billingProduct parameter to the RegisterImage API. - -Release v1.6.25 (2017-02-17) -=== - -Service Client Updates ---- -* `service/directconnect`: Updates service API, documentation, and paginators - * This update will introduce the ability for Direct Connect customers to take advantage of Link Aggregation (LAG). This allows you to bundle many individual physical interfaces into a single logical interface, referred to as a LAG. This makes administration much simpler as the majority of configuration is done on the LAG while you are free to add or remove physical interfaces from the bundle as bandwidth demand increases or decreases. A concrete example of the simplification added by LAG is that customers need only a single BGP session as opposed to one session per physical connection. - -Release v1.6.24 (2017-02-16) -=== - -Service Client Updates ---- -* `service/cognitoidentity`: Updates service API, documentation, and paginators - * Allow createIdentityPool and updateIdentityPool API to set server side token check value on identity pool -* `service/configservice`: Updates service API and documentation - * AWS Config now supports a new test mode for the PutEvaluations API. Set the TestMode parameter to true in your custom rule to verify whether your AWS Lambda function will deliver evaluation results to AWS Config. No updates occur to your existing evaluations, and evaluation results are not sent to AWS Config. - -Release v1.6.23 (2017-02-15) -=== - -Service Client Updates ---- -* `service/kms`: Updates service API, documentation, paginators, and examples - * his release of AWS Key Management Service introduces the ability to tag keys. Tagging keys can help you organize your keys and track your KMS costs in the cost allocation report. This release also increases the maximum length of a key ID to accommodate ARNs that include a long key alias. - -Release v1.6.22 (2017-02-14) -=== - -Service Client Updates ---- -* `service/ec2`: Updates service API, documentation, and paginators - * Adds support for the new Modify Volumes apis. - -Release v1.6.21 (2017-02-11) -=== - -Service Client Updates ---- -* `service/storagegateway`: Updates service API, documentation, and paginators - * File gateway mode in AWS Storage gateway provides access to objects in S3 as files on a Network File System (NFS) mount point. This is done by creating Nfs file shares using existing APIs CreateNfsFileShare. Using the feature in this update, the customer can restrict the clients that have read/write access to the gateway by specifying the list of clients as a list of IP addresses or CIDR blocks. This list can be specified using the API CreateNfsFileShare while creating new file shares, or UpdateNfsFileShare while update existing file shares. To find out the list of clients that have access, the existing API DescribeNfsFileShare will now output the list of clients that have access. - -Release v1.6.20 (2017-02-09) -=== - -Service Client Updates ---- -* `service/ec2`: Updates service API and documentation - * This feature allows customers to associate an IAM profile to running instances that do not have any. -* `service/rekognition`: Updates service API and documentation - * DetectFaces and IndexFaces operations now return an estimate of the age of the face as an age range. - -SDK Features ---- -* `aws/endpoints`: Add option to resolve unknown endpoints (#1074) -Release v1.6.19 (2017-02-08) -=== - -Service Client Updates ---- -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/glacier`: Updates service examples - * Doc Update -* `service/lexruntimeservice`: Adds new service - * Preview release - -SDK Bug Fixes ---- -* `private/protocol/json`: Fixes json to throw an error if a float number is (+/-)Inf and NaN (#1068) -* `private/model/api`: Fix documentation error listing (#1067) - -SDK Features ---- -* `private/model`: Add service response error code generation (#1061) - -Release v1.6.18 (2017-01-27) -=== - -Service Client Updates ---- -* `service/clouddirectory`: Adds new service - * Amazon Cloud Directory is a highly scalable, high performance, multi-tenant directory service in the cloud. Its web-based directories make it easy for you to organize and manage application resources such as users, groups, locations, devices, policies, and the rich relationships between them. -* `service/codedeploy`: Updates service API, documentation, and paginators - * This release of AWS CodeDeploy introduces support for blue/green deployments. In a blue/green deployment, the current set of instances in a deployment group is replaced by new instances that have the latest application revision installed on them. After traffic is rerouted behind a load balancer to the replacement instances, the original instances can be terminated automatically or kept running for other uses. -* `service/ec2`: Updates service API and documentation - * Adds instance health check functionality to replace unhealthy EC2 Spot fleet instances with fresh ones. -* `service/rds`: Updates service API and documentation - * Snapshot Engine Version Upgrade - -Release v1.6.17 (2017-01-25) -=== - -Service Client Updates ---- -* `service/elbv2`: Updates service API, documentation, and paginators - * Application Load Balancers now support native Internet Protocol version 6 (IPv6) in an Amazon Virtual Private Cloud (VPC). With this ability, clients can now connect to the Application Load Balancer in a dual-stack mode via either IPv4 or IPv6. -* `service/rds`: Updates service API and documentation - * Cross Region Read Replica Copying (CreateDBInstanceReadReplica) - -Release v1.6.16 (2017-01-24) -=== - -Service Client Updates ---- -* `service/codebuild`: Updates service documentation and paginators - * Documentation updates -* `service/codecommit`: Updates service API, documentation, and paginators - * AWS CodeCommit now includes the option to view the differences between a commit and its parent commit from within the console. You can view the differences inline (Unified view) or side by side (Split view). To view information about the differences between a commit and something other than its parent, you can use the AWS CLI and the get-differences and get-blob commands, or you can use the GetDifferences and GetBlob APIs. -* `service/ecs`: Updates service API and documentation - * Amazon ECS now supports a state for container instances that can be used to drain a container instance in preparation for maintenance or cluster scale down. - -Release v1.6.15 (2017-01-20) -=== - -Service Client Updates ---- -* `service/acm`: Updates service API, documentation, and paginators - * Update for AWS Certificate Manager: Updated response elements for DescribeCertificate API in support of managed renewal -* `service/health`: Updates service documentation - -Release v1.6.14 (2017-01-19) -=== - -Service Client Updates ---- -* `service/ec2`: Updates service API, documentation, and paginators - * Amazon EC2 Spot instances now support dedicated tenancy, providing the ability to run Spot instances single-tenant manner on physically isolated hardware within a VPC to satisfy security, privacy, or other compliance requirements. Dedicated Spot instances can be requested using RequestSpotInstances and RequestSpotFleet. - -Release v1.6.13 (2017-01-18) -=== - -Service Client Updates ---- -* `service/rds`: Updates service API, documentation, and paginators - -Release v1.6.12 (2017-01-17) -=== - -Service Client Updates ---- -* `service/dynamodb`: Updates service API, documentation, and paginators - * Tagging Support for Amazon DynamoDB Tables and Indexes -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/glacier`: Updates service API, paginators, and examples - * Doc-only Update for Glacier: Added code snippets -* `service/polly`: Updates service documentation and examples - * Doc-only update for Amazon Polly -- added snippets -* `service/rekognition`: Updates service documentation and paginators - * Added code samples to Rekognition reference topics. -* `service/route53`: Updates service API and paginators - * Add ca-central-1 and eu-west-2 enum values to CloudWatchRegion enum - -Release v1.6.11 (2017-01-16) -=== - -Service Client Updates ---- -* `service/configservice`: Updates service API, documentation, and paginators -* `service/costandusagereportservice`: Adds new service - * The AWS Cost and Usage Report Service API allows you to enable and disable the Cost & Usage report, as well as modify the report name, the data granularity, and the delivery preferences. -* `service/dynamodb`: Updates service API, documentation, and examples - * Snippets for the DynamoDB API. -* `service/elasticache`: Updates service API, documentation, and examples - * Adds new code examples. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.6.10 (2017-01-04) -=== - -Service Client Updates ---- -* `service/configservice`: Updates service API and documentation - * AWSConfig is planning to add support for OversizedConfigurationItemChangeNotification message type in putConfigRule. After this release customers can use/write rules based on OversizedConfigurationItemChangeNotification mesage type. -* `service/efs`: Updates service API, documentation, and examples - * Doc-only Update for EFS: Added code snippets -* `service/iam`: Updates service documentation and examples -* `service/lambda`: Updates service documentation and examples - * Doc only updates for Lambda: Added code snippets -* `service/marketplacecommerceanalytics`: Updates service API and documentation - * Added support for data set disbursed_amount_by_instance_hours, with historical data available starting 2012-09-04. New data is published to this data set every 30 days. -* `service/rds`: Updates service documentation - * Updated documentation for CopyDBSnapshot. -* `service/rekognition`: Updates service documentation and examples - * Doc-only Update for Rekognition: Added code snippets -* `service/snowball`: Updates service examples -* `service/dynamodbstreams`: Updates service API and examples - * Doc-only Update for DynamoDB Streams: Added code snippets - -SDK Feature ---- -* `private/model/api`: Increasing the readability of code generated files. (#1024) -Release v1.6.9 (2016-12-30) -=== - -Service Client Updates ---- -* `service/codedeploy`: Updates service API and documentation - * CodeDeploy will support Iam Session Arns in addition to Iam User Arns for on premise host authentication. -* `service/ecs`: Updates service API and documentation - * Amazon EC2 Container Service (ECS) now supports the ability to customize the placement of tasks on container instances. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.6.8 (2016-12-22) -=== - -Service Client Updates ---- -* `service/apigateway`: Updates service API and documentation - * Amazon API Gateway is adding support for generating SDKs in more languages. This update introduces two new operations used to dynamically discover these SDK types and what configuration each type accepts. -* `service/directoryservice`: Updates service documentation - * Added code snippets for the DS SDKs -* `service/elasticbeanstalk`: Updates service API and documentation -* `service/iam`: Updates service API and documentation - * Adds service-specific credentials to IAM service to make it easier to onboard CodeCommit customers. These are username/password credentials that work with a single service. -* `service/kms`: Updates service API, documentation, and examples - * Update docs and add SDK examples - -Release v1.6.7 (2016-12-22) -=== - -Service Client Updates ---- -* `service/ecr`: Updates service API and documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rds`: Updates service API and documentation - * Cross Region Encrypted Snapshot Copying (CopyDBSnapshot) - -Release v1.6.6 (2016-12-20) -=== - -Service Client Updates ---- -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/firehose`: Updates service API, documentation, and examples - * Processing feature enables users to process and modify records before Amazon Firehose delivers them to destinations. -* `service/route53`: Updates service API and documentation - * Enum updates for eu-west-2 and ca-central-1 -* `service/storagegateway`: Updates service API, documentation, and examples - * File gateway is a new mode in the AWS Storage Gateway that support a file interface into S3, alongside the current block-based volume and VTL storage. File gateway combines a service and virtual software appliance, enabling you to store and retrieve objects in Amazon S3 using industry standard file protocols such as NFS. The software appliance, or gateway, is deployed into your on-premises environment as a virtual machine (VM) running on VMware ESXi. The gateway provides access to objects in S3 as files on a Network File System (NFS) mount point. - -Release v1.6.5 (2016-12-19) -=== - -Service Client Updates ---- -* `service/cloudformation`: Updates service documentation - * Minor doc update for CloudFormation. -* `service/cloudtrail`: Updates service paginators -* `service/cognitoidentity`: Updates service API and documentation - * We are adding Groups to Cognito user pools. Developers can perform CRUD operations on groups, add and remove users from groups, list users in groups, etc. We are adding fine-grained role-based access control for Cognito identity pools. Developers can configure an identity pool to get the IAM role from an authenticated user's token, or they can configure rules that will map a user to a different role -* `service/applicationdiscoveryservice`: Updates service API and documentation - * Adds new APIs to group discovered servers into Applications with get summary and neighbors. Includes additional filters for ListConfigurations and DescribeAgents API. -* `service/inspector`: Updates service API, documentation, and examples - * Doc-only Update for Inspector: Adding SDK code snippets for Inspector -* `service/sqs`: Updates service documentation - -SDK Bug Fixes ---- -* `aws/request`: Add PriorRequestNotComplete to throttle retry codes (#1011) - * Fixes: Not retrying when PriorRequestNotComplete #1009 - -SDK Feature ---- -* `private/model/api`: Adds crosslinking to service documentation (#1010) - -Release v1.6.4 (2016-12-15) -=== - -Service Client Updates ---- -* `service/cognitoidentityprovider`: Updates service API and documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/ssm`: Updates service API and documentation - * This will provide customers with access to the Patch Baseline and Patch Compliance APIs. - -SDK Bug Fixes ---- -* `service/route53`: Fix URL path cleaning for Route53 API requests (#1006) - * Fixes: SerializationError when using Route53 ChangeResourceRecordSets #1005 -* `aws/request`: Add PriorRequestNotComplete to throttle retry codes (#1002) - * Fixes: Not retrying when PriorRequestNotComplete #1001 - -Release v1.6.3 (2016-12-14) -=== - -Service Client Updates ---- -* `service/batch`: Adds new service - * AWS Batch is a batch computing service that lets customers define queues and compute environments and then submit work as batch jobs. -* `service/databasemigrationservice`: Updates service API and documentation - * Adds support for SSL enabled Oracle endpoints and task modification. -* `service/elasticbeanstalk`: Updates service documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/cloudwatchlogs`: Updates service API and documentation - * Add support for associating LogGroups with AWSTagris tags -* `service/marketplacecommerceanalytics`: Updates service API and documentation - * Add new enum to DataSetType: sales_compensation_billed_revenue -* `service/rds`: Updates service documentation - * Doc-only Update for RDS: New versions available in CreateDBInstance -* `service/sts`: Updates service documentation - * Adding Code Snippet Examples for SDKs for STS - -SDK Bug Fixes ---- -* `aws/request`: Fix retrying timeout requests (#981) - * Fixes: Requests Retrying is broken if the error was caused due to a client timeout #947 -* `aws/request`: Fix for Go 1.8 request incorrectly sent with body (#991) - * Fixes: service/route53: ListHostedZones hangs and then fails with go1.8 #984 -* private/protocol/rest: Use RawPath instead of Opaque (#993) - * Fixes: HTTP2 request failing with REST protocol services, e.g AWS X-Ray -* private/model/api: Generate REST-JSON JSONVersion correctly (#998) - * Fixes: REST-JSON protocol service code missing JSONVersion metadata. - -Release v1.6.2 (2016-12-08) -=== - -Service Client Updates ---- -* `service/cloudfront`: Add lambda function associations to cache behaviors -* `service/codepipeline`: This is a doc-only update request to incorporate some recent minor revisions to the doc content. -* `service/rds`: Updates service API and documentation -* `service/wafregional`: With this new feature, customers can use AWS WAF directly on Application Load Balancers in a VPC within available regions to protect their websites and web services from malicious attacks such as SQL injection, Cross Site Scripting, bad bots, etc. - -Release v1.6.1 (2016-12-07) -=== - -Service Client Updates ---- -* `service/config`: Updates service API -* `service/s3`: Updates service API -* `service/sqs`: Updates service API and documentation - -Release v1.6.0 (2016-12-06) -=== - -Service Client Updates ---- -* `service/config`: Updates service API and documentation -* `service/ec2`: Updates service API -* `service/sts`: Updates service API, documentation, and examples - -SDK Bug Fixes ---- -* private/protocol/xml/xmlutil: Fix SDK XML unmarshaler #975 - * Fixes GetBucketACL Grantee required type always nil. #916 - -SDK Feature ---- -* aws/endpoints: Add endpoint metadata to SDK #961 - * Adds Region and Endpoint metadata to the SDK. This allows you to enumerate regions and endpoint metadata based on a defined model embedded in the SDK. - -Release v1.5.13 (2016-12-01) -=== - -Service Client Updates ---- -* `service/apigateway`: Updates service API and documentation -* `service/appstream`: Adds new service -* `service/codebuild`: Adds new service -* `service/directconnect`: Updates service API and documentation -* `service/ec2`: Adds new service -* `service/elasticbeanstalk`: Updates service API and documentation -* `service/health`: Adds new service -* `service/lambda`: Updates service API and documentation -* `service/opsworkscm`: Adds new service -* `service/pinpoint`: Adds new service -* `service/shield`: Adds new service -* `service/ssm`: Updates service API and documentation -* `service/states`: Adds new service -* `service/xray`: Adds new service - -Release v1.5.12 (2016-11-30) -=== - -Service Client Updates ---- -* `service/lightsail`: Adds new service -* `service/polly`: Adds new service -* `service/rekognition`: Adds new service -* `service/snowball`: Updates service API and documentation - -Release v1.5.11 (2016-11-29) -=== - -Service Client Updates ---- -`service/s3`: Updates service API and documentation - -Release v1.5.10 (2016-11-22) -=== - -Service Client Updates ---- -* `service/cloudformation`: Updates service API and documentation -* `service/glacier`: Updates service API, documentation, and examples -* `service/route53`: Updates service API and documentation -* `service/s3`: Updates service API and documentation - -SDK Bug Fixes ---- -* `private/protocol/xml/xmlutil`: Fixes xml marshaler to unmarshal properly -into tagged fields -[#916](https://github.com/aws/aws-sdk-go/issues/916) - -Release v1.5.9 (2016-11-22) -=== - -Service Client Updates ---- -* `service/cloudtrail`: Updates service API and documentation -* `service/ecs`: Updates service API and documentation - -Release v1.5.8 (2016-11-18) -=== - -Service Client Updates ---- -* `service/application-autoscaling`: Updates service API and documentation -* `service/elasticmapreduce`: Updates service API and documentation -* `service/elastictranscoder`: Updates service API, documentation, and examples -* `service/gamelift`: Updates service API and documentation -* `service/lambda`: Updates service API and documentation - -Release v1.5.7 (2016-11-18) -=== - -Service Client Updates ---- -* `service/apigateway`: Updates service API and documentation -* `service/meteringmarketplace`: Updates service API and documentation -* `service/monitoring`: Updates service API and documentation -* `service/sqs`: Updates service API, documentation, and examples - -Release v1.5.6 (2016-11-16) -=== - -Service Client Updates ---- -`service/route53`: Updates service API and documentation -`service/servicecatalog`: Updates service API and documentation - -Release v1.5.5 (2016-11-15) -=== - -Service Client Updates ---- -* `service/ds`: Updates service API and documentation -* `service/elasticache`: Updates service API and documentation -* `service/kinesis`: Updates service API and documentation - -Release v1.5.4 (2016-11-15) -=== - -Service Client Updates ---- -* `service/cognito-idp`: Updates service API and documentation - -Release v1.5.3 (2016-11-11) -=== - -Service Client Updates ---- -* `service/cloudformation`: Updates service documentation and examples -* `service/logs`: Updates service API and documentation - -Release v1.5.2 (2016-11-03) -=== - -Service Client Updates ---- -* `service/directconnect`: Updates service API and documentation - -Release v1.5.1 (2016-11-02) -=== - -Service Client Updates ---- -* `service/email`: Updates service API and documentation - -Release v1.5.0 (2016-11-01) -=== - -Service Client Updates ---- -* `service/cloudformation`: Updates service API and documentation -* `service/ecr`: Updates service paginators - -SDK Feature Updates ---- -* `private/model/api`: Add generated setters for API parameters (#918) - * Adds setters to the SDK's API parameter types, and are a convenience method that reduce the need to use `aws.String` and like utility. - -Release v1.4.22 (2016-10-25) -=== - -Service Client Updates ---- -* `service/elasticloadbalancingv2`: Updates service documentation. -* `service/autoscaling`: Updates service documentation. - -Release v1.4.21 (2016-10-24) -=== - -Service Client Updates ---- -* `service/sms`: AWS Server Migration Service (SMS) is an agentless service which makes it easier and faster for you to migrate thousands of on-premises workloads to AWS. AWS SMS allows you to automate, schedule, and track incremental replications of live server volumes, making it easier for you to coordinate large-scale server migrations. -* `service/ecs`: Updates documentation. - -SDK Feature Updates ---- -* `private/models/api`: Improve code generation of documentation. - -Release v1.4.20 (2016-10-20) -=== - -Service Client Updates ---- -* `service/budgets`: Adds new service, AWS Budgets. -* `service/waf`: Updates service documentation. - -Release v1.4.19 (2016-10-18) -=== - -Service Client Updates ---- -* `service/cloudfront`: Updates service API and documentation. - * Ability to use Amazon CloudFront to deliver your content both via IPv6 and IPv4 using HTTP/HTTPS. -* `service/configservice`: Update service API and documentation. -* `service/iot`: Updates service API and documentation. -* `service/kinesisanalytics`: Updates service API and documentation. - * Whenever Amazon Kinesis Analytics is not able to detect schema for the given streaming source on DiscoverInputSchema API, we would return the raw records that was sampled to detect the schema. -* `service/rds`: Updates service API and documentation. - * Amazon Aurora integrates with other AWS services to allow you to extend your Aurora DB cluster to utilize other capabilities in the AWS cloud. Permission to access other AWS services is granted by creating an IAM role with the necessary permissions, and then associating the role with your DB cluster. - -SDK Feature Updates ---- -* `service/dynamodb/dynamodbattribute`: Add UnmarshalListOfMaps #897 - * Adds support for unmarshaling a list of maps. This is useful for unmarshaling the DynamoDB AttributeValue list of maps returned by APIs like Query and Scan. - -Release v1.4.18 (2016-10-17) -=== - -Service Model Updates ---- -* `service/route53`: Updates service API and documentation. - -Release v1.4.17 -=== - -Service Model Updates ---- -* `service/acm`: Update service API, and documentation. - * This change allows users to import third-party SSL/TLS certificates into ACM. -* `service/elasticbeanstalk`: Update service API, documentation, and pagination. - * Elastic Beanstalk DescribeApplicationVersions API is being updated to support pagination. -* `service/gamelift`: Update service API, and documentation. - * New APIs to protect game developer resource (builds, alias, fleets, instances, game sessions and player sessions) against abuse. - -SDK Features ---- -* `service/s3`: Add support for accelerate with dualstack [#887](https://github.com/aws/aws-sdk-go/issues/887) - -Release v1.4.16 (2016-10-13) -=== - -Service Model Updates ---- -* `service/ecr`: Update Amazon EC2 Container Registry service model - * DescribeImages is a new api used to expose image metadata which today includes image size and image creation timestamp. -* `service/elasticache`: Update Amazon ElastiCache service model - * Elasticache is launching a new major engine release of Redis, 3.2 (providing stability updates and new command sets over 2.8), as well as ElasticSupport for enabling Redis Cluster in 3.2, which provides support for multiple node groups to horizontally scale data, as well as superior engine failover capabilities - -SDK Bug Fixes ---- -* `aws/session`: Skip shared config on read errors [#883](https://github.com/aws/aws-sdk-go/issues/883) -* `aws/signer/v4`: Add support for URL.EscapedPath to signer [#885](https://github.com/aws/aws-sdk-go/issues/885) - -SDK Features ---- -* `private/model/api`: Add docs for errors to API operations [#881](https://github.com/aws/aws-sdk-go/issues/881) -* `private/model/api`: Improve field and waiter doc strings [#879](https://github.com/aws/aws-sdk-go/issues/879) -* `service/dynamodb/dynamodbattribute`: Allow multiple struct tag elements [#886](https://github.com/aws/aws-sdk-go/issues/886) -* Add build tags to internal SDK tools [#880](https://github.com/aws/aws-sdk-go/issues/880) - -Release v1.4.15 (2016-10-06) -=== - -Service Model Updates ---- -* `service/cognitoidentityprovider`: Update Amazon Cognito Identity Provider service model -* `service/devicefarm`: Update AWS Device Farm documentation -* `service/opsworks`: Update AWS OpsWorks service model -* `service/s3`: Update Amazon Simple Storage Service model -* `service/waf`: Update AWS WAF service model - -SDK Bug Fixes ---- -* `aws/request`: Fix HTTP Request Body race condition [#874](https://github.com/aws/aws-sdk-go/issues/874) - -SDK Feature Updates ---- -* `aws/ec2metadata`: Add support for EC2 User Data [#872](https://github.com/aws/aws-sdk-go/issues/872) -* `aws/signer/v4`: Remove logic determining if request needs to be resigned [#876](https://github.com/aws/aws-sdk-go/issues/876) - -Release v1.4.14 (2016-09-29) -=== -* `service/ec2`: api, documentation, and paginators updates. -* `service/s3`: api and documentation updates. - -Release v1.4.13 (2016-09-27) -=== -* `service/codepipeline`: documentation updates. -* `service/cloudformation`: api and documentation updates. -* `service/kms`: documentation updates. -* `service/elasticfilesystem`: documentation updates. -* `service/snowball`: documentation updates. diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md deleted file mode 100644 index 8a1927a3..00000000 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG_PENDING.md +++ /dev/null @@ -1,5 +0,0 @@ -### SDK Features - -### SDK Enhancements - -### SDK Bugs diff --git a/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md b/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md deleted file mode 100644 index 6f422a95..00000000 --- a/vendor/github.com/aws/aws-sdk-go/CONTRIBUTING.md +++ /dev/null @@ -1,127 +0,0 @@ -Contributing to the AWS SDK for Go - -We work hard to provide a high-quality and useful SDK, and we greatly value -feedback and contributions from our community. Whether it's a bug report, -new feature, correction, or additional documentation, we welcome your issues -and pull requests. Please read through this document before submitting any -issues or pull requests to ensure we have all the necessary information to -effectively respond to your bug report or contribution. - - -## Filing Bug Reports - -You can file bug reports against the SDK on the [GitHub issues][issues] page. - -If you are filing a report for a bug or regression in the SDK, it's extremely -helpful to provide as much information as possible when opening the original -issue. This helps us reproduce and investigate the possible bug without having -to wait for this extra information to be provided. Please read the following -guidelines prior to filing a bug report. - -1. Search through existing [issues][] to ensure that your specific issue has - not yet been reported. If it is a common issue, it is likely there is - already a bug report for your problem. - -2. Ensure that you have tested the latest version of the SDK. Although you - may have an issue against an older version of the SDK, we cannot provide - bug fixes for old versions. It's also possible that the bug may have been - fixed in the latest release. - -3. Provide as much information about your environment, SDK version, and - relevant dependencies as possible. For example, let us know what version - of Go you are using, which and version of the operating system, and the - the environment your code is running in. e.g Container. - -4. Provide a minimal test case that reproduces your issue or any error - information you related to your problem. We can provide feedback much - more quickly if we know what operations you are calling in the SDK. If - you cannot provide a full test case, provide as much code as you can - to help us diagnose the problem. Any relevant information should be provided - as well, like whether this is a persistent issue, or if it only occurs - some of the time. - - -## Submitting Pull Requests - -We are always happy to receive code and documentation contributions to the SDK. -Please be aware of the following notes prior to opening a pull request: - -1. The SDK is released under the [Apache license][license]. Any code you submit - will be released under that license. For substantial contributions, we may - ask you to sign a [Contributor License Agreement (CLA)][cla]. - -2. If you would like to implement support for a significant feature that is not - yet available in the SDK, please talk to us beforehand to avoid any - duplication of effort. - -3. Wherever possible, pull requests should contain tests as appropriate. - Bugfixes should contain tests that exercise the corrected behavior (i.e., the - test should fail without the bugfix and pass with it), and new features - should be accompanied by tests exercising the feature. - -4. Pull requests that contain failing tests will not be merged until the test - failures are addressed. Pull requests that cause a significant drop in the - SDK's test coverage percentage are unlikely to be merged until tests have - been added. - -5. The JSON files under the SDK's `models` folder are sourced from outside the SDK. - Such as `models/apis/ec2/2016-11-15/api.json`. We will not accept pull requests - directly on these models. If you discover an issue with the models please - create a [GitHub issue][issues] describing the issue. - -### Testing - -To run the tests locally, running the `make unit` command will `go get` the -SDK's testing dependencies, and run vet, link and unit tests for the SDK. - -``` -make unit -``` - -Standard go testing functionality is supported as well. To test SDK code that -is tagged with `codegen` you'll need to set the build tag in the go test -command. The `make unit` command will do this automatically. - -``` -go test -tags codegen ./private/... -``` - -See the `Makefile` for additional testing tags that can be used in testing. - -To test on multiple platform the SDK includes several DockerFiles under the -`awstesting/sandbox` folder, and associated make recipes to to execute -unit testing within environments configured for specific Go versions. - -``` -make sandbox-test-go18 -``` - -To run all sandbox environments use the following make recipe - -``` -# Optionally update the Go tip that will be used during the batch testing -make update-aws-golang-tip - -# Run all SDK tests for supported Go versions in sandboxes -make sandbox-test -``` - -In addition the sandbox environment include make recipes for interactive modes -so you can run command within the Docker container and context of the SDK. - -``` -make sandbox-go18 -``` - -### Changelog - -You can see all release changes in the `CHANGELOG.md` file at the root of the -repository. The release notes added to this file will contain service client -updates, and major SDK changes. - -[issues]: https://github.com/aws/aws-sdk-go/issues -[pr]: https://github.com/aws/aws-sdk-go/pulls -[license]: http://aws.amazon.com/apache2.0/ -[cla]: http://en.wikipedia.org/wiki/Contributor_License_Agreement -[releasenotes]: https://github.com/aws/aws-sdk-go/releases - diff --git a/vendor/github.com/aws/aws-sdk-go/Gopkg.lock b/vendor/github.com/aws/aws-sdk-go/Gopkg.lock deleted file mode 100644 index 854c94fd..00000000 --- a/vendor/github.com/aws/aws-sdk-go/Gopkg.lock +++ /dev/null @@ -1,20 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/go-ini/ini" - packages = ["."] - revision = "300e940a926eb277d3901b20bdfcc54928ad3642" - version = "v1.25.4" - -[[projects]] - name = "github.com/jmespath/go-jmespath" - packages = ["."] - revision = "0b12d6b5" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "51a86a867df617990082dec6b868e4efe2fdb2ed0e02a3daa93cd30f962b5085" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/aws/aws-sdk-go/Gopkg.toml b/vendor/github.com/aws/aws-sdk-go/Gopkg.toml deleted file mode 100644 index 664fc595..00000000 --- a/vendor/github.com/aws/aws-sdk-go/Gopkg.toml +++ /dev/null @@ -1,48 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - -ignored = [ - # Testing/Example/Codegen dependencies - "github.com/stretchr/testify", - "github.com/stretchr/testify/assert", - "github.com/stretchr/testify/require", - "github.com/go-sql-driver/mysql", - "github.com/gucumber/gucumber", - "github.com/pkg/errors", - "golang.org/x/net", - "golang.org/x/net/html", - "golang.org/x/net/http2", - "golang.org/x/text", - "golang.org/x/text/html", - "golang.org/x/tools", - "golang.org/x/tools/go/loader", -] - - -[[constraint]] - name = "github.com/go-ini/ini" - version = "1.25.4" - -[[constraint]] - name = "github.com/jmespath/go-jmespath" - revision = "0b12d6b5" - #version = "0.2.2" diff --git a/vendor/github.com/aws/aws-sdk-go/LICENSE.txt b/vendor/github.com/aws/aws-sdk-go/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/vendor/github.com/aws/aws-sdk-go/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/aws/aws-sdk-go/Makefile b/vendor/github.com/aws/aws-sdk-go/Makefile deleted file mode 100644 index 83ccc1e6..00000000 --- a/vendor/github.com/aws/aws-sdk-go/Makefile +++ /dev/null @@ -1,187 +0,0 @@ -LINTIGNOREDOT='awstesting/integration.+should not use dot imports' -LINTIGNOREDOC='service/[^/]+/(api|service|waiters)\.go:.+(comment on exported|should have comment or be unexported)' -LINTIGNORECONST='service/[^/]+/(api|service|waiters)\.go:.+(type|struct field|const|func) ([^ ]+) should be ([^ ]+)' -LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)' -LINTIGNOREINFLECT='service/[^/]+/(api|errors|service)\.go:.+(method|const) .+ should be ' -LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId should be ' -LINTIGNOREDEPS='vendor/.+\.go' -LINTIGNOREPKGCOMMENT='service/[^/]+/doc_custom.go:.+package comment should be of the form' -UNIT_TEST_TAGS="example codegen awsinclude" - -SDK_WITH_VENDOR_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/src") -SDK_ONLY_PKGS=$(shell go list ./... | grep -v "/vendor/") -SDK_UNIT_TEST_ONLY_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/") -SDK_GO_1_4=$(shell go version | grep "go1.4") -SDK_GO_1_5=$(shell go version | grep "go1.5") -SDK_GO_VERSION=$(shell go version | awk '''{print $$3}''' | tr -d '''\n''') - -all: get-deps generate unit - -help: - @echo "Please use \`make ' where is one of" - @echo " api_info to print a list of services and versions" - @echo " docs to build SDK documentation" - @echo " build to go build the SDK" - @echo " unit to run unit tests" - @echo " integration to run integration tests" - @echo " performance to run performance tests" - @echo " verify to verify tests" - @echo " lint to lint the SDK" - @echo " vet to vet the SDK" - @echo " generate to go generate and make services" - @echo " gen-test to generate protocol tests" - @echo " gen-services to generate services" - @echo " get-deps to go get the SDK dependencies" - @echo " get-deps-tests to get the SDK's test dependencies" - @echo " get-deps-verify to get the SDK's verification dependencies" - -generate: gen-test gen-endpoints gen-services - -gen-test: gen-protocol-test - -gen-services: - go generate ./service - -gen-protocol-test: - go generate ./private/protocol/... - -gen-endpoints: - go generate ./models/endpoints/ - -build: - @echo "go build SDK and vendor packages" - @go build ${SDK_ONLY_PKGS} - -unit: get-deps-tests build verify - @echo "go test SDK and vendor packages" - @go test -tags ${UNIT_TEST_TAGS} $(SDK_UNIT_TEST_ONLY_PKGS) - -unit-with-race-cover: get-deps-tests build verify - @echo "go test SDK and vendor packages" - @go test -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 $(SDK_UNIT_TEST_ONLY_PKGS) - -integration: get-deps-tests integ-custom smoke-tests performance - -integ-custom: - go test -tags "integration" ./awstesting/integration/customizations/... - -cleanup-integ: - go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration" - -smoke-tests: get-deps-tests - gucumber -go-tags "integration" ./awstesting/integration/smoke - -performance: get-deps-tests - AWS_TESTING_LOG_RESULTS=${log-detailed} AWS_TESTING_REGION=$(region) AWS_TESTING_DB_TABLE=$(table) gucumber -go-tags "integration" ./awstesting/performance - -sandbox-tests: sandbox-test-go15 sandbox-test-go15-novendorexp sandbox-test-go16 sandbox-test-go17 sandbox-test-go18 sandbox-test-go19 sandbox-test-gotip - -sandbox-build-go15: - docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5 -t "aws-sdk-go-1.5" . -sandbox-go15: sandbox-build-go15 - docker run -i -t aws-sdk-go-1.5 bash -sandbox-test-go15: sandbox-build-go15 - docker run -t aws-sdk-go-1.5 - -sandbox-build-go15-novendorexp: - docker build -f ./awstesting/sandbox/Dockerfile.test.go1.5-novendorexp -t "aws-sdk-go-1.5-novendorexp" . -sandbox-go15-novendorexp: sandbox-build-go15-novendorexp - docker run -i -t aws-sdk-go-1.5-novendorexp bash -sandbox-test-go15-novendorexp: sandbox-build-go15-novendorexp - docker run -t aws-sdk-go-1.5-novendorexp - -sandbox-build-go16: - docker build -f ./awstesting/sandbox/Dockerfile.test.go1.6 -t "aws-sdk-go-1.6" . -sandbox-go16: sandbox-build-go16 - docker run -i -t aws-sdk-go-1.6 bash -sandbox-test-go16: sandbox-build-go16 - docker run -t aws-sdk-go-1.6 - -sandbox-build-go17: - docker build -f ./awstesting/sandbox/Dockerfile.test.go1.7 -t "aws-sdk-go-1.7" . -sandbox-go17: sandbox-build-go17 - docker run -i -t aws-sdk-go-1.7 bash -sandbox-test-go17: sandbox-build-go17 - docker run -t aws-sdk-go-1.7 - -sandbox-build-go18: - docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.8" . -sandbox-go18: sandbox-build-go18 - docker run -i -t aws-sdk-go-1.8 bash -sandbox-test-go18: sandbox-build-go18 - docker run -t aws-sdk-go-1.8 - -sandbox-build-go19: - docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.9" . -sandbox-go19: sandbox-build-go19 - docker run -i -t aws-sdk-go-1.9 bash -sandbox-test-go19: sandbox-build-go19 - docker run -t aws-sdk-go-1.9 - -sandbox-build-gotip: - @echo "Run make update-aws-golang-tip, if this test fails because missing aws-golang:tip container" - docker build -f ./awstesting/sandbox/Dockerfile.test.gotip -t "aws-sdk-go-tip" . -sandbox-gotip: sandbox-build-gotip - docker run -i -t aws-sdk-go-tip bash -sandbox-test-gotip: sandbox-build-gotip - docker run -t aws-sdk-go-tip - -update-aws-golang-tip: - docker build --no-cache=true -f ./awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" . - -verify: get-deps-verify lint vet - -lint: - @echo "go lint SDK and vendor packages" - @lint=`if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then golint ./...; else echo "skipping golint"; fi`; \ - lint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOT} -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT}`; \ - echo "$$lint"; \ - if [ "$$lint" != "" ] && [ "$$lint" != "skipping golint" ]; then exit 1; fi - -SDK_BASE_FOLDERS=$(shell ls -d */ | grep -v vendor | grep -v awsmigrate) -ifneq (,$(findstring go1.4, ${SDK_GO_VERSION})) - GO_VET_CMD=echo skipping go vet, ${SDK_GO_VERSION} -else ifneq (,$(findstring go1.6, ${SDK_GO_VERSION})) - GO_VET_CMD=go tool vet --all -shadow -example=false -else - GO_VET_CMD=go tool vet --all -shadow -endif - -vet: - ${GO_VET_CMD} ${SDK_BASE_FOLDERS} - -get-deps: get-deps-tests get-deps-verify - @echo "go get SDK dependencies" - @go get -v $(SDK_ONLY_PKGS) - -get-deps-tests: - @echo "go get SDK testing dependencies" - go get github.com/gucumber/gucumber/cmd/gucumber - go get github.com/stretchr/testify - go get github.com/smartystreets/goconvey - go get golang.org/x/net/html - go get golang.org/x/net/http2 - -get-deps-verify: - @echo "go get SDK verification utilities" - @if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then go get github.com/golang/lint/golint; else echo "skipped getting golint"; fi - -bench: - @echo "go bench SDK packages" - @go test -run NONE -bench . -benchmem -tags 'bench' $(SDK_ONLY_PKGS) - -bench-protocol: - @echo "go bench SDK protocol marshallers" - @go test -run NONE -bench . -benchmem -tags 'bench' ./private/protocol/... - -docs: - @echo "generate SDK docs" - @# This env variable, DOCS, is for internal use - @if [ -z ${AWS_DOC_GEN_TOOL} ]; then\ - rm -rf doc && bundle install && bundle exec yard;\ - else\ - $(AWS_DOC_GEN_TOOL) `pwd`;\ - fi - -api_info: - @go run private/model/cli/api-info/api-info.go diff --git a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt deleted file mode 100644 index 5f14d116..00000000 --- a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt +++ /dev/null @@ -1,3 +0,0 @@ -AWS SDK for Go -Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. -Copyright 2014-2015 Stripe, Inc. diff --git a/vendor/github.com/aws/aws-sdk-go/README.md b/vendor/github.com/aws/aws-sdk-go/README.md deleted file mode 100644 index d8acfdd0..00000000 --- a/vendor/github.com/aws/aws-sdk-go/README.md +++ /dev/null @@ -1,449 +0,0 @@ -[![API Reference](http://img.shields.io/badge/api-reference-blue.svg)](http://docs.aws.amazon.com/sdk-for-go/api) [![Join the chat at https://gitter.im/aws/aws-sdk-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aws/aws-sdk-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://img.shields.io/travis/aws/aws-sdk-go.svg)](https://travis-ci.org/aws/aws-sdk-go) [![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt) - -# AWS SDK for Go - -aws-sdk-go is the official AWS SDK for the Go programming language. - -Checkout our [release notes](https://github.com/aws/aws-sdk-go/releases) for information about the latest bug fixes, updates, and features added to the SDK. - -## Installing - -If you are using Go 1.5 with the `GO15VENDOREXPERIMENT=1` vendoring flag, or 1.6 and higher you can use the following command to retrieve the SDK. The SDK's non-testing dependencies will be included and are vendored in the `vendor` folder. - - go get -u github.com/aws/aws-sdk-go - -Otherwise if your Go environment does not have vendoring support enabled, or you do not want to include the vendored SDK's dependencies you can use the following command to retrieve the SDK and its non-testing dependencies using `go get`. - - go get -u github.com/aws/aws-sdk-go/aws/... - go get -u github.com/aws/aws-sdk-go/service/... - -If you're looking to retrieve just the SDK without any dependencies use the following command. - - go get -d github.com/aws/aws-sdk-go/ - -These two processes will still include the `vendor` folder and it should be deleted if its not going to be used by your environment. - - rm -rf $GOPATH/src/github.com/aws/aws-sdk-go/vendor - -## Getting Help - -Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests. - -* Ask a question on [StackOverflow](http://stackoverflow.com/) and tag it with the [`aws-sdk-go`](http://stackoverflow.com/questions/tagged/aws-sdk-go) tag. -* Come join the AWS SDK for Go community chat on [gitter](https://gitter.im/aws/aws-sdk-go). -* Open a support ticket with [AWS Support](http://docs.aws.amazon.com/awssupport/latest/user/getting-started.html). -* If you think you may have found a bug, please open an [issue](https://github.com/aws/aws-sdk-go/issues/new). - -## Opening Issues - -If you encounter a bug with the AWS SDK for Go we would like to hear about it. Search the [existing issues](https://github.com/aws/aws-sdk-go/issues) and see if others are also experiencing the issue before opening a new issue. Please include the version of AWS SDK for Go, Go language, and OS you’re using. Please also include repro case when appropriate. - -The GitHub issues are intended for bug reports and feature requests. For help and questions with using AWS SDK for GO please make use of the resources listed in the [Getting Help](https://github.com/aws/aws-sdk-go#getting-help) section. Keeping the list of open issues lean will help us respond in a timely manner. - -## Reference Documentation - -[`Getting Started Guide`](https://aws.amazon.com/sdk-for-go/) - This document is a general introduction how to configure and make requests with the SDK. If this is your first time using the SDK, this documentation and the API documentation will help you get started. This document focuses on the syntax and behavior of the SDK. The [Service Developer Guide](https://aws.amazon.com/documentation/) will help you get started using specific AWS services. - -[`SDK API Reference Documentation`](https://docs.aws.amazon.com/sdk-for-go/api/) - Use this document to look up all API operation input and output parameters for AWS services supported by the SDK. The API reference also includes documentation of the SDK, and examples how to using the SDK, service client API operations, and API operation require parameters. - -[`Service Developer Guide`](https://aws.amazon.com/documentation/) - Use this documentation to learn how to interface with an AWS service. These are great guides both, if you're getting started with a service, or looking for more information on a service. You should not need this document for coding, though in some cases, services may supply helpful samples that you might want to look out for. - -[`SDK Examples`](https://github.com/aws/aws-sdk-go/tree/master/example) - Included in the SDK's repo are a several hand crafted examples using the SDK features and AWS services. - -## Overview of SDK's Packages - -The SDK is composed of two main components, SDK core, and service clients. -The SDK core packages are all available under the aws package at the root of -the SDK. Each client for a supported AWS service is available within its own -package under the service folder at the root of the SDK. - - * aws - SDK core, provides common shared types such as Config, Logger, - and utilities to make working with API parameters easier. - - * awserr - Provides the error interface that the SDK will use for all - errors that occur in the SDK's processing. This includes service API - response errors as well. The Error type is made up of a code and message. - Cast the SDK's returned error type to awserr.Error and call the Code - method to compare returned error to specific error codes. See the package's - documentation for additional values that can be extracted such as RequestID. - - * credentials - Provides the types and built in credentials providers - the SDK will use to retrieve AWS credentials to make API requests with. - Nested under this folder are also additional credentials providers such as - stscreds for assuming IAM roles, and ec2rolecreds for EC2 Instance roles. - - * endpoints - Provides the AWS Regions and Endpoints metadata for the SDK. - Use this to lookup AWS service endpoint information such as which services - are in a region, and what regions a service is in. Constants are also provided - for all region identifiers, e.g UsWest2RegionID for "us-west-2". - - * session - Provides initial default configuration, and load - configuration from external sources such as environment and shared - credentials file. - - * request - Provides the API request sending, and retry logic for the SDK. - This package also includes utilities for defining your own request - retryer, and configuring how the SDK processes the request. - - * service - Clients for AWS services. All services supported by the SDK are - available under this folder. - -## How to Use the SDK's AWS Service Clients - -The SDK includes the Go types and utilities you can use to make requests to -AWS service APIs. Within the service folder at the root of the SDK you'll find -a package for each AWS service the SDK supports. All service clients follows -a common pattern of creation and usage. - -When creating a client for an AWS service you'll first need to have a Session -value constructed. The Session provides shared configuration that can be shared -between your service clients. When service clients are created you can pass -in additional configuration via the aws.Config type to override configuration -provided by in the Session to create service client instances with custom -configuration. - -Once the service's client is created you can use it to make API requests the -AWS service. These clients are safe to use concurrently. - -## Configuring the SDK - -In the AWS SDK for Go, you can configure settings for service clients, such -as the log level and maximum number of retries. Most settings are optional; -however, for each service client, you must specify a region and your credentials. -The SDK uses these values to send requests to the correct AWS region and sign -requests with the correct credentials. You can specify these values as part -of a session or as environment variables. - -See the SDK's [configuration guide][config_guide] for more information. - -See the [session][session_pkg] package documentation for more information on how to use Session -with the SDK. - -See the [Config][config_typ] type in the [aws][aws_pkg] package for more information on configuration -options. - -[config_guide]: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html -[session_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/session/ -[config_typ]: https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -[aws_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/ - -### Configuring Credentials - -When using the SDK you'll generally need your AWS credentials to authenticate -with AWS services. The SDK supports multiple methods of supporting these -credentials. By default the SDK will source credentials automatically from -its default credential chain. See the session package for more information -on this chain, and how to configure it. The common items in the credential -chain are the following: - - * Environment Credentials - Set of environment variables that are useful - when sub processes are created for specific roles. - - * Shared Credentials file (~/.aws/credentials) - This file stores your - credentials based on a profile name and is useful for local development. - - * EC2 Instance Role Credentials - Use EC2 Instance Role to assign credentials - to application running on an EC2 instance. This removes the need to manage - credential files in production. - -Credentials can be configured in code as well by setting the Config's Credentials -value to a custom provider or using one of the providers included with the -SDK to bypass the default credential chain and use a custom one. This is -helpful when you want to instruct the SDK to only use a specific set of -credentials or providers. - -This example creates a credential provider for assuming an IAM role, "myRoleARN" -and configures the S3 service client to use that role for API requests. - -```go - // Initial credentials loaded from SDK's default credential chain. Such as - // the environment, shared credentials (~/.aws/credentials), or EC2 Instance - // Role. These credentials will be used to to make the STS Assume Role API. - sess := session.Must(session.NewSession()) - - // Create the credentials from AssumeRoleProvider to assume the role - // referenced by the "myRoleARN" ARN. - creds := stscreds.NewCredentials(sess, "myRoleArn") - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess, &aws.Config{Credentials: creds}) -``` - -See the [credentials][credentials_pkg] package documentation for more information on credential -providers included with the SDK, and how to customize the SDK's usage of -credentials. - -The SDK has support for the shared configuration file (~/.aws/config). This -support can be enabled by setting the environment variable, "AWS_SDK_LOAD_CONFIG=1", -or enabling the feature in code when creating a Session via the -Option's SharedConfigState parameter. - -```go - sess := session.Must(session.NewSessionWithOptions(session.Options{ - SharedConfigState: session.SharedConfigEnable, - })) -``` - -[credentials_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials - -### Configuring AWS Region - -In addition to the credentials you'll need to specify the region the SDK -will use to make AWS API requests to. In the SDK you can specify the region -either with an environment variable, or directly in code when a Session or -service client is created. The last value specified in code wins if the region -is specified multiple ways. - -To set the region via the environment variable set the "AWS_REGION" to the -region you want to the SDK to use. Using this method to set the region will -allow you to run your application in multiple regions without needing additional -code in the application to select the region. - - AWS_REGION=us-west-2 - -The endpoints package includes constants for all regions the SDK knows. The -values are all suffixed with RegionID. These values are helpful, because they -reduce the need to type the region string manually. - -To set the region on a Session use the aws package's Config struct parameter -Region to the AWS region you want the service clients created from the session to -use. This is helpful when you want to create multiple service clients, and -all of the clients make API requests to the same region. - -```go - sess := session.Must(session.NewSession(&aws.Config{ - Region: aws.String(endpoints.UsWest2RegionID), - })) -``` - -See the [endpoints][endpoints_pkg] package for the AWS Regions and Endpoints metadata. - -In addition to setting the region when creating a Session you can also set -the region on a per service client bases. This overrides the region of a -Session. This is helpful when you want to create service clients in specific -regions different from the Session's region. - -```go - svc := s3.New(sess, &aws.Config{ - Region: aws.String(endpoints.UsWest2RegionID), - }) -``` - -See the [Config][config_typ] type in the [aws][aws_pkg] package for more information and additional -options such as setting the Endpoint, and other service client configuration options. - -[endpoints_pkg]: https://docs.aws.amazon.com/sdk-for-go/api/aws/endpoints/ - -## Making API Requests - -Once the client is created you can make an API request to the service. -Each API method takes a input parameter, and returns the service response -and an error. The SDK provides methods for making the API call in multiple ways. - -In this list we'll use the S3 ListObjects API as an example for the different -ways of making API requests. - - * ListObjects - Base API operation that will make the API request to the service. - - * ListObjectsRequest - API methods suffixed with Request will construct the - API request, but not send it. This is also helpful when you want to get a - presigned URL for a request, and share the presigned URL instead of your - application making the request directly. - - * ListObjectsPages - Same as the base API operation, but uses a callback to - automatically handle pagination of the API's response. - - * ListObjectsWithContext - Same as base API operation, but adds support for - the Context pattern. This is helpful for controlling the canceling of in - flight requests. See the Go standard library context package for more - information. This method also takes request package's Option functional - options as the variadic argument for modifying how the request will be - made, or extracting information from the raw HTTP response. - - * ListObjectsPagesWithContext - same as ListObjectsPages, but adds support for - the Context pattern. Similar to ListObjectsWithContext this method also - takes the request package's Option function option types as the variadic - argument. - -In addition to the API operations the SDK also includes several higher level -methods that abstract checking for and waiting for an AWS resource to be in -a desired state. In this list we'll use WaitUntilBucketExists to demonstrate -the different forms of waiters. - - * WaitUntilBucketExists. - Method to make API request to query an AWS service for - a resource's state. Will return successfully when that state is accomplished. - - * WaitUntilBucketExistsWithContext - Same as WaitUntilBucketExists, but adds - support for the Context pattern. In addition these methods take request - package's WaiterOptions to configure the waiter, and how underlying request - will be made by the SDK. - -The API method will document which error codes the service might return for -the operation. These errors will also be available as const strings prefixed -with "ErrCode" in the service client's package. If there are no errors listed -in the API's SDK documentation you'll need to consult the AWS service's API -documentation for the errors that could be returned. - -```go - ctx := context.Background() - - result, err := svc.GetObjectWithContext(ctx, &s3.GetObjectInput{ - Bucket: aws.String("my-bucket"), - Key: aws.String("my-key"), - }) - if err != nil { - // Cast err to awserr.Error to handle specific error codes. - aerr, ok := err.(awserr.Error) - if ok && aerr.Code() == s3.ErrCodeNoSuchKey { - // Specific error code handling - } - return err - } - - // Make sure to close the body when done with it for S3 GetObject APIs or - // will leak connections. - defer result.Body.Close() - - fmt.Println("Object Size:", aws.StringValue(result.ContentLength)) -``` - -### API Request Pagination and Resource Waiters - -Pagination helper methods are suffixed with "Pages", and provide the -functionality needed to round trip API page requests. Pagination methods -take a callback function that will be called for each page of the API's response. - -```go - objects := []string{} - err := svc.ListObjectsPagesWithContext(ctx, &s3.ListObjectsInput{ - Bucket: aws.String(myBucket), - }, func(p *s3.ListObjectsOutput, lastPage bool) bool { - for _, o := range p.Contents { - objects = append(objects, aws.StringValue(o.Key)) - } - return true // continue paging - }) - if err != nil { - panic(fmt.Sprintf("failed to list objects for bucket, %s, %v", myBucket, err)) - } - - fmt.Println("Objects in bucket:", objects) -``` - -Waiter helper methods provide the functionality to wait for an AWS resource -state. These methods abstract the logic needed to to check the state of an -AWS resource, and wait until that resource is in a desired state. The waiter -will block until the resource is in the state that is desired, an error occurs, -or the waiter times out. If a resource times out the error code returned will -be request.WaiterResourceNotReadyErrorCode. - -```go - err := svc.WaitUntilBucketExistsWithContext(ctx, &s3.HeadBucketInput{ - Bucket: aws.String(myBucket), - }) - if err != nil { - aerr, ok := err.(awserr.Error) - if ok && aerr.Code() == request.WaiterResourceNotReadyErrorCode { - fmt.Fprintf(os.Stderr, "timed out while waiting for bucket to exist") - } - panic(fmt.Errorf("failed to wait for bucket to exist, %v", err)) - } - fmt.Println("Bucket", myBucket, "exists") -``` - -## Complete SDK Example - -This example shows a complete working Go file which will upload a file to S3 -and use the Context pattern to implement timeout logic that will cancel the -request if it takes too long. This example highlights how to use sessions, -create a service client, make a request, handle the error, and process the -response. - -```go - package main - - import ( - "context" - "flag" - "fmt" - "os" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/s3" - ) - - // Uploads a file to S3 given a bucket and object key. Also takes a duration - // value to terminate the update if it doesn't complete within that time. - // - // The AWS Region needs to be provided in the AWS shared config or on the - // environment variable as `AWS_REGION`. Credentials also must be provided - // Will default to shared config file, but can load from environment if provided. - // - // Usage: - // # Upload myfile.txt to myBucket/myKey. Must complete within 10 minutes or will fail - // go run withContext.go -b mybucket -k myKey -d 10m < myfile.txt - func main() { - var bucket, key string - var timeout time.Duration - - flag.StringVar(&bucket, "b", "", "Bucket name.") - flag.StringVar(&key, "k", "", "Object key name.") - flag.DurationVar(&timeout, "d", 0, "Upload timeout.") - flag.Parse() - - // All clients require a Session. The Session provides the client with - // shared configuration such as region, endpoint, and credentials. A - // Session should be shared where possible to take advantage of - // configuration and credential caching. See the session package for - // more information. - sess := session.Must(session.NewSession()) - - // Create a new instance of the service's client with a Session. - // Optional aws.Config values can also be provided as variadic arguments - // to the New function. This option allows you to provide service - // specific configuration. - svc := s3.New(sess) - - // Create a context with a timeout that will abort the upload if it takes - // more than the passed in timeout. - ctx := context.Background() - var cancelFn func() - if timeout > 0 { - ctx, cancelFn = context.WithTimeout(ctx, timeout) - } - // Ensure the context is canceled to prevent leaking. - // See context package for more information, https://golang.org/pkg/context/ - defer cancelFn() - - // Uploads the object to S3. The Context will interrupt the request if the - // timeout expires. - _, err := svc.PutObjectWithContext(ctx, &s3.PutObjectInput{ - Bucket: aws.String(bucket), - Key: aws.String(key), - Body: os.Stdin, - }) - if err != nil { - if aerr, ok := err.(awserr.Error); ok && aerr.Code() == request.CanceledErrorCode { - // If the SDK can determine the request or retry delay was canceled - // by a context the CanceledErrorCode error code will be returned. - fmt.Fprintf(os.Stderr, "upload canceled due to timeout, %v\n", err) - } else { - fmt.Fprintf(os.Stderr, "failed to upload object, %v\n", err) - } - os.Exit(1) - } - - fmt.Printf("successfully uploaded file to %s/%s\n", bucket, key) - } -``` - -## License - -This SDK is distributed under the -[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), -see LICENSE.txt and NOTICE.txt for more information. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go deleted file mode 100644 index 56fdfc2b..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go +++ /dev/null @@ -1,145 +0,0 @@ -// Package awserr represents API error interface accessors for the SDK. -package awserr - -// An Error wraps lower level errors with code, message and an original error. -// The underlying concrete error type may also satisfy other interfaces which -// can be to used to obtain more specific information about the error. -// -// Calling Error() or String() will always include the full information about -// an error based on its underlying type. -// -// Example: -// -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if awsErr, ok := err.(awserr.Error); ok { -// // Get error details -// log.Println("Error:", awsErr.Code(), awsErr.Message()) -// -// // Prints out full error message, including original error if there was one. -// log.Println("Error:", awsErr.Error()) -// -// // Get original error -// if origErr := awsErr.OrigErr(); origErr != nil { -// // operate on original error. -// } -// } else { -// fmt.Println(err.Error()) -// } -// } -// -type Error interface { - // Satisfy the generic error interface. - error - - // Returns the short phrase depicting the classification of the error. - Code() string - - // Returns the error details message. - Message() string - - // Returns the original error if one was set. Nil is returned if not set. - OrigErr() error -} - -// BatchError is a batch of errors which also wraps lower level errors with -// code, message, and original errors. Calling Error() will include all errors -// that occurred in the batch. -// -// Deprecated: Replaced with BatchedErrors. Only defined for backwards -// compatibility. -type BatchError interface { - // Satisfy the generic error interface. - error - - // Returns the short phrase depicting the classification of the error. - Code() string - - // Returns the error details message. - Message() string - - // Returns the original error if one was set. Nil is returned if not set. - OrigErrs() []error -} - -// BatchedErrors is a batch of errors which also wraps lower level errors with -// code, message, and original errors. Calling Error() will include all errors -// that occurred in the batch. -// -// Replaces BatchError -type BatchedErrors interface { - // Satisfy the base Error interface. - Error - - // Returns the original error if one was set. Nil is returned if not set. - OrigErrs() []error -} - -// New returns an Error object described by the code, message, and origErr. -// -// If origErr satisfies the Error interface it will not be wrapped within a new -// Error object and will instead be returned. -func New(code, message string, origErr error) Error { - var errs []error - if origErr != nil { - errs = append(errs, origErr) - } - return newBaseError(code, message, errs) -} - -// NewBatchError returns an BatchedErrors with a collection of errors as an -// array of errors. -func NewBatchError(code, message string, errs []error) BatchedErrors { - return newBaseError(code, message, errs) -} - -// A RequestFailure is an interface to extract request failure information from -// an Error such as the request ID of the failed request returned by a service. -// RequestFailures may not always have a requestID value if the request failed -// prior to reaching the service such as a connection error. -// -// Example: -// -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if reqerr, ok := err.(RequestFailure); ok { -// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) -// } else { -// log.Println("Error:", err.Error()) -// } -// } -// -// Combined with awserr.Error: -// -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if awsErr, ok := err.(awserr.Error); ok { -// // Generic AWS Error with Code, Message, and original error (if any) -// fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) -// -// if reqErr, ok := err.(awserr.RequestFailure); ok { -// // A service error occurred -// fmt.Println(reqErr.StatusCode(), reqErr.RequestID()) -// } -// } else { -// fmt.Println(err.Error()) -// } -// } -// -type RequestFailure interface { - Error - - // The status code of the HTTP response. - StatusCode() int - - // The request ID returned by the service for a request failure. This will - // be empty if no request ID is available such as the request failed due - // to a connection error. - RequestID() string -} - -// NewRequestFailure returns a new request error wrapper for the given Error -// provided. -func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure { - return newRequestError(err, statusCode, reqID) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go deleted file mode 100644 index 0202a008..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ /dev/null @@ -1,194 +0,0 @@ -package awserr - -import "fmt" - -// SprintError returns a string of the formatted error code. -// -// Both extra and origErr are optional. If they are included their lines -// will be added, but if they are not included their lines will be ignored. -func SprintError(code, message, extra string, origErr error) string { - msg := fmt.Sprintf("%s: %s", code, message) - if extra != "" { - msg = fmt.Sprintf("%s\n\t%s", msg, extra) - } - if origErr != nil { - msg = fmt.Sprintf("%s\ncaused by: %s", msg, origErr.Error()) - } - return msg -} - -// A baseError wraps the code and message which defines an error. It also -// can be used to wrap an original error object. -// -// Should be used as the root for errors satisfying the awserr.Error. Also -// for any error which does not fit into a specific error wrapper type. -type baseError struct { - // Classification of error - code string - - // Detailed information about error - message string - - // Optional original error this error is based off of. Allows building - // chained errors. - errs []error -} - -// newBaseError returns an error object for the code, message, and errors. -// -// code is a short no whitespace phrase depicting the classification of -// the error that is being created. -// -// message is the free flow string containing detailed information about the -// error. -// -// origErrs is the error objects which will be nested under the new errors to -// be returned. -func newBaseError(code, message string, origErrs []error) *baseError { - b := &baseError{ - code: code, - message: message, - errs: origErrs, - } - - return b -} - -// Error returns the string representation of the error. -// -// See ErrorWithExtra for formatting. -// -// Satisfies the error interface. -func (b baseError) Error() string { - size := len(b.errs) - if size > 0 { - return SprintError(b.code, b.message, "", errorList(b.errs)) - } - - return SprintError(b.code, b.message, "", nil) -} - -// String returns the string representation of the error. -// Alias for Error to satisfy the stringer interface. -func (b baseError) String() string { - return b.Error() -} - -// Code returns the short phrase depicting the classification of the error. -func (b baseError) Code() string { - return b.code -} - -// Message returns the error details message. -func (b baseError) Message() string { - return b.message -} - -// OrigErr returns the original error if one was set. Nil is returned if no -// error was set. This only returns the first element in the list. If the full -// list is needed, use BatchedErrors. -func (b baseError) OrigErr() error { - switch len(b.errs) { - case 0: - return nil - case 1: - return b.errs[0] - default: - if err, ok := b.errs[0].(Error); ok { - return NewBatchError(err.Code(), err.Message(), b.errs[1:]) - } - return NewBatchError("BatchedErrors", - "multiple errors occurred", b.errs) - } -} - -// OrigErrs returns the original errors if one was set. An empty slice is -// returned if no error was set. -func (b baseError) OrigErrs() []error { - return b.errs -} - -// So that the Error interface type can be included as an anonymous field -// in the requestError struct and not conflict with the error.Error() method. -type awsError Error - -// A requestError wraps a request or service error. -// -// Composed of baseError for code, message, and original error. -type requestError struct { - awsError - statusCode int - requestID string -} - -// newRequestError returns a wrapped error with additional information for -// request status code, and service requestID. -// -// Should be used to wrap all request which involve service requests. Even if -// the request failed without a service response, but had an HTTP status code -// that may be meaningful. -// -// Also wraps original errors via the baseError. -func newRequestError(err Error, statusCode int, requestID string) *requestError { - return &requestError{ - awsError: err, - statusCode: statusCode, - requestID: requestID, - } -} - -// Error returns the string representation of the error. -// Satisfies the error interface. -func (r requestError) Error() string { - extra := fmt.Sprintf("status code: %d, request id: %s", - r.statusCode, r.requestID) - return SprintError(r.Code(), r.Message(), extra, r.OrigErr()) -} - -// String returns the string representation of the error. -// Alias for Error to satisfy the stringer interface. -func (r requestError) String() string { - return r.Error() -} - -// StatusCode returns the wrapped status code for the error -func (r requestError) StatusCode() int { - return r.statusCode -} - -// RequestID returns the wrapped requestID -func (r requestError) RequestID() string { - return r.requestID -} - -// OrigErrs returns the original errors if one was set. An empty slice is -// returned if no error was set. -func (r requestError) OrigErrs() []error { - if b, ok := r.awsError.(BatchedErrors); ok { - return b.OrigErrs() - } - return []error{r.OrigErr()} -} - -// An error list that satisfies the golang interface -type errorList []error - -// Error returns the string representation of the error. -// -// Satisfies the error interface. -func (e errorList) Error() string { - msg := "" - // How do we want to handle the array size being zero - if size := len(e); size > 0 { - for i := 0; i < size; i++ { - msg += fmt.Sprintf("%s", e[i].Error()) - // We check the next index to see if it is within the slice. - // If it is, then we append a newline. We do this, because unit tests - // could be broken with the additional '\n' - if i+1 < size { - msg += "\n" - } - } - } - return msg -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go deleted file mode 100644 index 1a3d106d..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go +++ /dev/null @@ -1,108 +0,0 @@ -package awsutil - -import ( - "io" - "reflect" - "time" -) - -// Copy deeply copies a src structure to dst. Useful for copying request and -// response structures. -// -// Can copy between structs of different type, but will only copy fields which -// are assignable, and exist in both structs. Fields which are not assignable, -// or do not exist in both structs are ignored. -func Copy(dst, src interface{}) { - dstval := reflect.ValueOf(dst) - if !dstval.IsValid() { - panic("Copy dst cannot be nil") - } - - rcopy(dstval, reflect.ValueOf(src), true) -} - -// CopyOf returns a copy of src while also allocating the memory for dst. -// src must be a pointer type or this operation will fail. -func CopyOf(src interface{}) (dst interface{}) { - dsti := reflect.New(reflect.TypeOf(src).Elem()) - dst = dsti.Interface() - rcopy(dsti, reflect.ValueOf(src), true) - return -} - -// rcopy performs a recursive copy of values from the source to destination. -// -// root is used to skip certain aspects of the copy which are not valid -// for the root node of a object. -func rcopy(dst, src reflect.Value, root bool) { - if !src.IsValid() { - return - } - - switch src.Kind() { - case reflect.Ptr: - if _, ok := src.Interface().(io.Reader); ok { - if dst.Kind() == reflect.Ptr && dst.Elem().CanSet() { - dst.Elem().Set(src) - } else if dst.CanSet() { - dst.Set(src) - } - } else { - e := src.Type().Elem() - if dst.CanSet() && !src.IsNil() { - if _, ok := src.Interface().(*time.Time); !ok { - dst.Set(reflect.New(e)) - } else { - tempValue := reflect.New(e) - tempValue.Elem().Set(src.Elem()) - // Sets time.Time's unexported values - dst.Set(tempValue) - } - } - if src.Elem().IsValid() { - // Keep the current root state since the depth hasn't changed - rcopy(dst.Elem(), src.Elem(), root) - } - } - case reflect.Struct: - t := dst.Type() - for i := 0; i < t.NumField(); i++ { - name := t.Field(i).Name - srcVal := src.FieldByName(name) - dstVal := dst.FieldByName(name) - if srcVal.IsValid() && dstVal.CanSet() { - rcopy(dstVal, srcVal, false) - } - } - case reflect.Slice: - if src.IsNil() { - break - } - - s := reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) - dst.Set(s) - for i := 0; i < src.Len(); i++ { - rcopy(dst.Index(i), src.Index(i), false) - } - case reflect.Map: - if src.IsNil() { - break - } - - s := reflect.MakeMap(src.Type()) - dst.Set(s) - for _, k := range src.MapKeys() { - v := src.MapIndex(k) - v2 := reflect.New(v.Type()).Elem() - rcopy(v2, v, false) - dst.SetMapIndex(k, v2) - } - default: - // Assign the value if possible. If its not assignable, the value would - // need to be converted and the impact of that may be unexpected, or is - // not compatible with the dst type. - if src.Type().AssignableTo(dst.Type()) { - dst.Set(src) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go deleted file mode 100644 index 007b37be..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go +++ /dev/null @@ -1,353 +0,0 @@ -package awsutil_test - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "reflect" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -func ExampleCopy() { - type Foo struct { - A int - B []*string - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - f1 := &Foo{A: 1, B: []*string{&str1, &str2}} - - // Do the copy - var f2 Foo - awsutil.Copy(&f2, f1) - - // Print the result - fmt.Println(awsutil.Prettify(f2)) - - // Output: - // { - // A: 1, - // B: ["hello","bye bye"] - // } -} - -func TestCopy1(t *testing.T) { - type Bar struct { - a *int - B *int - c int - D int - } - type Foo struct { - A int - B []*string - C map[string]*int - D *time.Time - E *Bar - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - int1 := 1 - int2 := 2 - intPtr1 := 1 - intPtr2 := 2 - now := time.Now() - f1 := &Foo{ - A: 1, - B: []*string{&str1, &str2}, - C: map[string]*int{ - "A": &int1, - "B": &int2, - }, - D: &now, - E: &Bar{ - &intPtr1, - &intPtr2, - 2, - 3, - }, - } - - // Do the copy - var f2 Foo - awsutil.Copy(&f2, f1) - - // Values are equal - if v1, v2 := f2.A, f1.A; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.B, f1.B; !reflect.DeepEqual(v1, v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.C, f1.C; !reflect.DeepEqual(v1, v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.D, f1.D; !v1.Equal(*v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.E.B, f1.E.B; !reflect.DeepEqual(v1, v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.E.D, f1.E.D; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - - // But pointers are not! - str3 := "nothello" - int3 := 57 - f2.A = 100 - *f2.B[0] = str3 - *f2.C["B"] = int3 - *f2.D = time.Now() - f2.E.a = &int3 - *f2.E.B = int3 - f2.E.c = 5 - f2.E.D = 5 - if v1, v2 := f2.A, f1.A; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.B, f1.B; reflect.DeepEqual(v1, v2) { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.C, f1.C; reflect.DeepEqual(v1, v2) { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.D, f1.D; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.E.a, f1.E.a; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.E.B, f1.E.B; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.E.c, f1.E.c; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.E.D, f1.E.D; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } -} - -func TestCopyNestedWithUnexported(t *testing.T) { - type Bar struct { - a int - B int - } - type Foo struct { - A string - B Bar - } - - f1 := &Foo{A: "string", B: Bar{a: 1, B: 2}} - - var f2 Foo - awsutil.Copy(&f2, f1) - - // Values match - if v1, v2 := f2.A, f1.A; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.B, f1.B; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.B.a, f1.B.a; v1 == v2 { - t.Errorf("expected values to be not equivalent, but received %v", v1) - } - if v1, v2 := f2.B.B, f2.B.B; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } -} - -func TestCopyIgnoreNilMembers(t *testing.T) { - type Foo struct { - A *string - B []string - C map[string]string - } - - f := &Foo{} - if v1 := f.A; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - if v1 := f.B; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - if v1 := f.C; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - - var f2 Foo - awsutil.Copy(&f2, f) - if v1 := f2.A; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - if v1 := f2.B; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - if v1 := f2.C; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - - fcopy := awsutil.CopyOf(f) - f3 := fcopy.(*Foo) - if v1 := f3.A; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - if v1 := f3.B; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - if v1 := f3.C; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } -} - -func TestCopyPrimitive(t *testing.T) { - str := "hello" - var s string - awsutil.Copy(&s, &str) - if v1, v2 := "hello", s; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } -} - -func TestCopyNil(t *testing.T) { - var s string - awsutil.Copy(&s, nil) - if v1, v2 := "", s; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } -} - -func TestCopyReader(t *testing.T) { - var buf io.Reader = bytes.NewReader([]byte("hello world")) - var r io.Reader - awsutil.Copy(&r, buf) - b, err := ioutil.ReadAll(r) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if v1, v2 := []byte("hello world"), b; !bytes.Equal(v1, v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - - // empty bytes because this is not a deep copy - b, err = ioutil.ReadAll(buf) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if v1, v2 := []byte(""), b; !bytes.Equal(v1, v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } -} - -func TestCopyDifferentStructs(t *testing.T) { - type SrcFoo struct { - A int - B []*string - C map[string]*int - SrcUnique string - SameNameDiffType int - unexportedPtr *int - ExportedPtr *int - } - type DstFoo struct { - A int - B []*string - C map[string]*int - DstUnique int - SameNameDiffType string - unexportedPtr *int - ExportedPtr *int - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - int1 := 1 - int2 := 2 - f1 := &SrcFoo{ - A: 1, - B: []*string{&str1, &str2}, - C: map[string]*int{ - "A": &int1, - "B": &int2, - }, - SrcUnique: "unique", - SameNameDiffType: 1, - unexportedPtr: &int1, - ExportedPtr: &int2, - } - - // Do the copy - var f2 DstFoo - awsutil.Copy(&f2, f1) - - // Values are equal - if v1, v2 := f2.A, f1.A; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.B, f1.B; !reflect.DeepEqual(v1, v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := f2.C, f1.C; !reflect.DeepEqual(v1, v2) { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := "unique", f1.SrcUnique; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := 1, f1.SameNameDiffType; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := 0, f2.DstUnique; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := "", f2.SameNameDiffType; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := int1, *f1.unexportedPtr; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1 := f2.unexportedPtr; v1 != nil { - t.Errorf("expected nil, but received %v", v1) - } - if v1, v2 := int2, *f1.ExportedPtr; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } - if v1, v2 := int2, *f2.ExportedPtr; v1 != v2 { - t.Errorf("expected values to be equivalent but received %v and %v", v1, v2) - } -} - -func ExampleCopyOf() { - type Foo struct { - A int - B []*string - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - f1 := &Foo{A: 1, B: []*string{&str1, &str2}} - - // Do the copy - v := awsutil.CopyOf(f1) - var f2 *Foo = v.(*Foo) - - // Print the result - fmt.Println(awsutil.Prettify(f2)) - - // Output: - // { - // A: 1, - // B: ["hello","bye bye"] - // } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go deleted file mode 100644 index 59fa4a55..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go +++ /dev/null @@ -1,27 +0,0 @@ -package awsutil - -import ( - "reflect" -) - -// DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. -// In addition to this, this method will also dereference the input values if -// possible so the DeepEqual performed will not fail if one parameter is a -// pointer and the other is not. -// -// DeepEqual will not perform indirection of nested values of the input parameters. -func DeepEqual(a, b interface{}) bool { - ra := reflect.Indirect(reflect.ValueOf(a)) - rb := reflect.Indirect(reflect.ValueOf(b)) - - if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { - // If the elements are both nil, and of the same type the are equal - // If they are of different types they are not equal - return reflect.TypeOf(a) == reflect.TypeOf(b) - } else if raValid != rbValid { - // Both values must be valid to be equal - return false - } - - return reflect.DeepEqual(ra.Interface(), rb.Interface()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go deleted file mode 100644 index 18d3c5b8..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package awsutil_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -func TestDeepEqual(t *testing.T) { - cases := []struct { - a, b interface{} - equal bool - }{ - {"a", "a", true}, - {"a", "b", false}, - {"a", aws.String(""), false}, - {"a", nil, false}, - {"a", aws.String("a"), true}, - {(*bool)(nil), (*bool)(nil), true}, - {(*bool)(nil), (*string)(nil), false}, - {nil, nil, true}, - } - - for i, c := range cases { - if awsutil.DeepEqual(c.a, c.b) != c.equal { - t.Errorf("%d, a:%v b:%v, %t", i, c.a, c.b, c.equal) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go deleted file mode 100644 index 11c52c38..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go +++ /dev/null @@ -1,222 +0,0 @@ -package awsutil - -import ( - "reflect" - "regexp" - "strconv" - "strings" - - "github.com/jmespath/go-jmespath" -) - -var indexRe = regexp.MustCompile(`(.+)\[(-?\d+)?\]$`) - -// rValuesAtPath returns a slice of values found in value v. The values -// in v are explored recursively so all nested values are collected. -func rValuesAtPath(v interface{}, path string, createPath, caseSensitive, nilTerm bool) []reflect.Value { - pathparts := strings.Split(path, "||") - if len(pathparts) > 1 { - for _, pathpart := range pathparts { - vals := rValuesAtPath(v, pathpart, createPath, caseSensitive, nilTerm) - if len(vals) > 0 { - return vals - } - } - return nil - } - - values := []reflect.Value{reflect.Indirect(reflect.ValueOf(v))} - components := strings.Split(path, ".") - for len(values) > 0 && len(components) > 0 { - var index *int64 - var indexStar bool - c := strings.TrimSpace(components[0]) - if c == "" { // no actual component, illegal syntax - return nil - } else if caseSensitive && c != "*" && strings.ToLower(c[0:1]) == c[0:1] { - // TODO normalize case for user - return nil // don't support unexported fields - } - - // parse this component - if m := indexRe.FindStringSubmatch(c); m != nil { - c = m[1] - if m[2] == "" { - index = nil - indexStar = true - } else { - i, _ := strconv.ParseInt(m[2], 10, 32) - index = &i - indexStar = false - } - } - - nextvals := []reflect.Value{} - for _, value := range values { - // pull component name out of struct member - if value.Kind() != reflect.Struct { - continue - } - - if c == "*" { // pull all members - for i := 0; i < value.NumField(); i++ { - if f := reflect.Indirect(value.Field(i)); f.IsValid() { - nextvals = append(nextvals, f) - } - } - continue - } - - value = value.FieldByNameFunc(func(name string) bool { - if c == name { - return true - } else if !caseSensitive && strings.ToLower(name) == strings.ToLower(c) { - return true - } - return false - }) - - if nilTerm && value.Kind() == reflect.Ptr && len(components[1:]) == 0 { - if !value.IsNil() { - value.Set(reflect.Zero(value.Type())) - } - return []reflect.Value{value} - } - - if createPath && value.Kind() == reflect.Ptr && value.IsNil() { - // TODO if the value is the terminus it should not be created - // if the value to be set to its position is nil. - value.Set(reflect.New(value.Type().Elem())) - value = value.Elem() - } else { - value = reflect.Indirect(value) - } - - if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { - if !createPath && value.IsNil() { - value = reflect.ValueOf(nil) - } - } - - if value.IsValid() { - nextvals = append(nextvals, value) - } - } - values = nextvals - - if indexStar || index != nil { - nextvals = []reflect.Value{} - for _, valItem := range values { - value := reflect.Indirect(valItem) - if value.Kind() != reflect.Slice { - continue - } - - if indexStar { // grab all indices - for i := 0; i < value.Len(); i++ { - idx := reflect.Indirect(value.Index(i)) - if idx.IsValid() { - nextvals = append(nextvals, idx) - } - } - continue - } - - // pull out index - i := int(*index) - if i >= value.Len() { // check out of bounds - if createPath { - // TODO resize slice - } else { - continue - } - } else if i < 0 { // support negative indexing - i = value.Len() + i - } - value = reflect.Indirect(value.Index(i)) - - if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { - if !createPath && value.IsNil() { - value = reflect.ValueOf(nil) - } - } - - if value.IsValid() { - nextvals = append(nextvals, value) - } - } - values = nextvals - } - - components = components[1:] - } - return values -} - -// ValuesAtPath returns a list of values at the case insensitive lexical -// path inside of a structure. -func ValuesAtPath(i interface{}, path string) ([]interface{}, error) { - result, err := jmespath.Search(path, i) - if err != nil { - return nil, err - } - - v := reflect.ValueOf(result) - if !v.IsValid() || (v.Kind() == reflect.Ptr && v.IsNil()) { - return nil, nil - } - if s, ok := result.([]interface{}); ok { - return s, err - } - if v.Kind() == reflect.Map && v.Len() == 0 { - return nil, nil - } - if v.Kind() == reflect.Slice { - out := make([]interface{}, v.Len()) - for i := 0; i < v.Len(); i++ { - out[i] = v.Index(i).Interface() - } - return out, nil - } - - return []interface{}{result}, nil -} - -// SetValueAtPath sets a value at the case insensitive lexical path inside -// of a structure. -func SetValueAtPath(i interface{}, path string, v interface{}) { - if rvals := rValuesAtPath(i, path, true, false, v == nil); rvals != nil { - for _, rval := range rvals { - if rval.Kind() == reflect.Ptr && rval.IsNil() { - continue - } - setValue(rval, v) - } - } -} - -func setValue(dstVal reflect.Value, src interface{}) { - if dstVal.Kind() == reflect.Ptr { - dstVal = reflect.Indirect(dstVal) - } - srcVal := reflect.ValueOf(src) - - if !srcVal.IsValid() { // src is literal nil - if dstVal.CanAddr() { - // Convert to pointer so that pointer's value can be nil'ed - // dstVal = dstVal.Addr() - } - dstVal.Set(reflect.Zero(dstVal.Type())) - - } else if srcVal.Kind() == reflect.Ptr { - if srcVal.IsNil() { - srcVal = reflect.Zero(dstVal.Type()) - } else { - srcVal = reflect.ValueOf(src).Elem() - } - dstVal.Set(srcVal) - } else { - dstVal.Set(srcVal) - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go deleted file mode 100644 index 58a05d6c..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go +++ /dev/null @@ -1,182 +0,0 @@ -package awsutil_test - -import ( - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -type Struct struct { - A []Struct - z []Struct - B *Struct - D *Struct - C string - E map[string]string -} - -var data = Struct{ - A: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}}, - z: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}}, - B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}}, - C: "initial", -} -var data2 = Struct{A: []Struct{ - {A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}}, - {A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}}, -}} - -func TestValueAtPathSuccess(t *testing.T) { - var testCases = []struct { - expect []interface{} - data interface{} - path string - }{ - {[]interface{}{"initial"}, data, "C"}, - {[]interface{}{"value1"}, data, "A[0].C"}, - {[]interface{}{"value2"}, data, "A[1].C"}, - {[]interface{}{"value3"}, data, "A[2].C"}, - {[]interface{}{"value3"}, data, "a[2].c"}, - {[]interface{}{"value3"}, data, "A[-1].C"}, - {[]interface{}{"value1", "value2", "value3"}, data, "A[].C"}, - {[]interface{}{"terminal"}, data, "B . B . C"}, - {[]interface{}{"initial"}, data, "A.D.X || C"}, - {[]interface{}{"initial"}, data, "A[0].B || C"}, - {[]interface{}{ - Struct{A: []Struct{{C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}, {C: "1"}}}, - Struct{A: []Struct{{C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}, {C: "2"}}}, - }, data2, "A"}, - } - for i, c := range testCases { - v, err := awsutil.ValuesAtPath(c.data, c.path) - if err != nil { - t.Errorf("case %v, expected no error, %v", i, c.path) - } - if e, a := c.expect, v; !awsutil.DeepEqual(e, a) { - t.Errorf("case %v, %v", i, c.path) - } - } -} - -func TestValueAtPathFailure(t *testing.T) { - var testCases = []struct { - expect []interface{} - errContains string - data interface{} - path string - }{ - {nil, "", data, "C.x"}, - {nil, "SyntaxError: Invalid token: tDot", data, ".x"}, - {nil, "", data, "X.Y.Z"}, - {nil, "", data, "A[100].C"}, - {nil, "", data, "A[3].C"}, - {nil, "", data, "B.B.C.Z"}, - {nil, "", data, "z[-1].C"}, - {nil, "", nil, "A.B.C"}, - {[]interface{}{}, "", Struct{}, "A"}, - {nil, "", data, "A[0].B.C"}, - {nil, "", data, "D"}, - } - - for i, c := range testCases { - v, err := awsutil.ValuesAtPath(c.data, c.path) - if c.errContains != "" { - if !strings.Contains(err.Error(), c.errContains) { - t.Errorf("case %v, expected error, %v", i, c.path) - } - continue - } else { - if err != nil { - t.Errorf("case %v, expected no error, %v", i, c.path) - } - } - if e, a := c.expect, v; !awsutil.DeepEqual(e, a) { - t.Errorf("case %v, %v", i, c.path) - } - } -} - -func TestSetValueAtPathSuccess(t *testing.T) { - var s Struct - awsutil.SetValueAtPath(&s, "C", "test1") - awsutil.SetValueAtPath(&s, "B.B.C", "test2") - awsutil.SetValueAtPath(&s, "B.D.C", "test3") - if e, a := "test1", s.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - if e, a := "test2", s.B.B.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - if e, a := "test3", s.B.D.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - awsutil.SetValueAtPath(&s, "B.*.C", "test0") - if e, a := "test0", s.B.B.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - if e, a := "test0", s.B.D.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - var s2 Struct - awsutil.SetValueAtPath(&s2, "b.b.c", "test0") - if e, a := "test0", s2.B.B.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - awsutil.SetValueAtPath(&s2, "A", []Struct{{}}) - if e, a := []Struct{{}}, s2.A; !awsutil.DeepEqual(e, a) { - t.Errorf("expected %v, but received %v", e, a) - } - - str := "foo" - - s3 := Struct{} - awsutil.SetValueAtPath(&s3, "b.b.c", str) - if e, a := "foo", s3.B.B.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - s3 = Struct{B: &Struct{B: &Struct{C: str}}} - awsutil.SetValueAtPath(&s3, "b.b.c", nil) - if e, a := "", s3.B.B.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - s3 = Struct{} - awsutil.SetValueAtPath(&s3, "b.b.c", nil) - if e, a := "", s3.B.B.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - s3 = Struct{} - awsutil.SetValueAtPath(&s3, "b.b.c", &str) - if e, a := "foo", s3.B.B.C; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - var s4 struct{ Name *string } - awsutil.SetValueAtPath(&s4, "Name", str) - if e, a := str, *s4.Name; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - s4 = struct{ Name *string }{} - awsutil.SetValueAtPath(&s4, "Name", nil) - if e, a := (*string)(nil), s4.Name; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - s4 = struct{ Name *string }{Name: &str} - awsutil.SetValueAtPath(&s4, "Name", nil) - if e, a := (*string)(nil), s4.Name; e != a { - t.Errorf("expected %v, but received %v", e, a) - } - - s4 = struct{ Name *string }{} - awsutil.SetValueAtPath(&s4, "Name", &str) - if e, a := str, *s4.Name; e != a { - t.Errorf("expected %v, but received %v", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go deleted file mode 100644 index 710eb432..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go +++ /dev/null @@ -1,113 +0,0 @@ -package awsutil - -import ( - "bytes" - "fmt" - "io" - "reflect" - "strings" -) - -// Prettify returns the string representation of a value. -func Prettify(i interface{}) string { - var buf bytes.Buffer - prettify(reflect.ValueOf(i), 0, &buf) - return buf.String() -} - -// prettify will recursively walk value v to build a textual -// representation of the value. -func prettify(v reflect.Value, indent int, buf *bytes.Buffer) { - for v.Kind() == reflect.Ptr { - v = v.Elem() - } - - switch v.Kind() { - case reflect.Struct: - strtype := v.Type().String() - if strtype == "time.Time" { - fmt.Fprintf(buf, "%s", v.Interface()) - break - } else if strings.HasPrefix(strtype, "io.") { - buf.WriteString("") - break - } - - buf.WriteString("{\n") - - names := []string{} - for i := 0; i < v.Type().NumField(); i++ { - name := v.Type().Field(i).Name - f := v.Field(i) - if name[0:1] == strings.ToLower(name[0:1]) { - continue // ignore unexported fields - } - if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice || f.Kind() == reflect.Map) && f.IsNil() { - continue // ignore unset fields - } - names = append(names, name) - } - - for i, n := range names { - val := v.FieldByName(n) - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(n + ": ") - prettify(val, indent+2, buf) - - if i < len(names)-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - case reflect.Slice: - strtype := v.Type().String() - if strtype == "[]uint8" { - fmt.Fprintf(buf, " len %d", v.Len()) - break - } - - nl, id, id2 := "", "", "" - if v.Len() > 3 { - nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) - } - buf.WriteString("[" + nl) - for i := 0; i < v.Len(); i++ { - buf.WriteString(id2) - prettify(v.Index(i), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString("," + nl) - } - } - - buf.WriteString(nl + id + "]") - case reflect.Map: - buf.WriteString("{\n") - - for i, k := range v.MapKeys() { - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(k.String() + ": ") - prettify(v.MapIndex(k), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - default: - if !v.IsValid() { - fmt.Fprint(buf, "") - return - } - format := "%v" - switch v.Interface().(type) { - case string: - format = "%q" - case io.ReadSeeker, io.Reader: - format = "buffer(%p)" - } - fmt.Fprintf(buf, format, v.Interface()) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go deleted file mode 100644 index b6432f1a..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go +++ /dev/null @@ -1,89 +0,0 @@ -package awsutil - -import ( - "bytes" - "fmt" - "reflect" - "strings" -) - -// StringValue returns the string representation of a value. -func StringValue(i interface{}) string { - var buf bytes.Buffer - stringValue(reflect.ValueOf(i), 0, &buf) - return buf.String() -} - -func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { - for v.Kind() == reflect.Ptr { - v = v.Elem() - } - - switch v.Kind() { - case reflect.Struct: - buf.WriteString("{\n") - - names := []string{} - for i := 0; i < v.Type().NumField(); i++ { - name := v.Type().Field(i).Name - f := v.Field(i) - if name[0:1] == strings.ToLower(name[0:1]) { - continue // ignore unexported fields - } - if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice) && f.IsNil() { - continue // ignore unset fields - } - names = append(names, name) - } - - for i, n := range names { - val := v.FieldByName(n) - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(n + ": ") - stringValue(val, indent+2, buf) - - if i < len(names)-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - case reflect.Slice: - nl, id, id2 := "", "", "" - if v.Len() > 3 { - nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) - } - buf.WriteString("[" + nl) - for i := 0; i < v.Len(); i++ { - buf.WriteString(id2) - stringValue(v.Index(i), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString("," + nl) - } - } - - buf.WriteString(nl + id + "]") - case reflect.Map: - buf.WriteString("{\n") - - for i, k := range v.MapKeys() { - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(k.String() + ": ") - stringValue(v.MapIndex(k), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - default: - format := "%v" - switch v.Interface().(type) { - case string: - format = "%q" - } - fmt.Fprintf(buf, format, v.Interface()) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go deleted file mode 100644 index 788fe6e2..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ /dev/null @@ -1,90 +0,0 @@ -package client - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" -) - -// A Config provides configuration to a service client instance. -type Config struct { - Config *aws.Config - Handlers request.Handlers - Endpoint string - SigningRegion string - SigningName string -} - -// ConfigProvider provides a generic way for a service client to receive -// the ClientConfig without circular dependencies. -type ConfigProvider interface { - ClientConfig(serviceName string, cfgs ...*aws.Config) Config -} - -// ConfigNoResolveEndpointProvider same as ConfigProvider except it will not -// resolve the endpoint automatically. The service client's endpoint must be -// provided via the aws.Config.Endpoint field. -type ConfigNoResolveEndpointProvider interface { - ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) Config -} - -// A Client implements the base client request and response handling -// used by all service clients. -type Client struct { - request.Retryer - metadata.ClientInfo - - Config aws.Config - Handlers request.Handlers -} - -// New will return a pointer to a new initialized service client. -func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, options ...func(*Client)) *Client { - svc := &Client{ - Config: cfg, - ClientInfo: info, - Handlers: handlers.Copy(), - } - - switch retryer, ok := cfg.Retryer.(request.Retryer); { - case ok: - svc.Retryer = retryer - case cfg.Retryer != nil && cfg.Logger != nil: - s := fmt.Sprintf("WARNING: %T does not implement request.Retryer; using DefaultRetryer instead", cfg.Retryer) - cfg.Logger.Log(s) - fallthrough - default: - maxRetries := aws.IntValue(cfg.MaxRetries) - if cfg.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries { - maxRetries = 3 - } - svc.Retryer = DefaultRetryer{NumMaxRetries: maxRetries} - } - - svc.AddDebugHandlers() - - for _, option := range options { - option(svc) - } - - return svc -} - -// NewRequest returns a new Request pointer for the service API -// operation and parameters. -func (c *Client) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request { - return request.New(c.Config, c.ClientInfo, c.Handlers, c.Retryer, operation, params, data) -} - -// AddDebugHandlers injects debug logging handlers into the service to log request -// debug information. -func (c *Client) AddDebugHandlers() { - if !c.Config.LogLevel.AtLeast(aws.LogDebug) { - return - } - - c.Handlers.Send.PushFrontNamed(request.NamedHandler{Name: "awssdk.client.LogRequest", Fn: logRequest}) - c.Handlers.Send.PushBackNamed(request.NamedHandler{Name: "awssdk.client.LogResponse", Fn: logResponse}) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go deleted file mode 100644 index 30d3b999..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/client_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package client - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" -) - -func pushBackTestHandler(name string, list *request.HandlerList) *bool { - called := false - (*list).PushBackNamed(request.NamedHandler{ - Name: name, - Fn: func(r *request.Request) { - called = true - }, - }) - - return &called -} - -func pushFrontTestHandler(name string, list *request.HandlerList) *bool { - called := false - (*list).PushFrontNamed(request.NamedHandler{ - Name: name, - Fn: func(r *request.Request) { - called = true - }, - }) - - return &called -} - -func TestNewClient_CopyHandlers(t *testing.T) { - handlers := request.Handlers{} - firstCalled := pushBackTestHandler("first", &handlers.Send) - secondCalled := pushBackTestHandler("second", &handlers.Send) - - var clientHandlerCalled *bool - c := New(aws.Config{}, metadata.ClientInfo{}, handlers, - func(c *Client) { - clientHandlerCalled = pushFrontTestHandler("client handler", &c.Handlers.Send) - }, - ) - - if e, a := 2, handlers.Send.Len(); e != a { - t.Errorf("expect %d original handlers, got %d", e, a) - } - if e, a := 3, c.Handlers.Send.Len(); e != a { - t.Errorf("expect %d client handlers, got %d", e, a) - } - - handlers.Send.Run(nil) - if !*firstCalled { - t.Errorf("expect first handler to of been called") - } - *firstCalled = false - if !*secondCalled { - t.Errorf("expect second handler to of been called") - } - *secondCalled = false - if *clientHandlerCalled { - t.Errorf("expect client handler to not of been called, but was") - } - - c.Handlers.Send.Run(nil) - if !*firstCalled { - t.Errorf("expect client's first handler to of been called") - } - if !*secondCalled { - t.Errorf("expect client's second handler to of been called") - } - if !*clientHandlerCalled { - t.Errorf("expect client's client handler to of been called") - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go deleted file mode 100644 index e25a460f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ /dev/null @@ -1,96 +0,0 @@ -package client - -import ( - "math/rand" - "sync" - "time" - - "github.com/aws/aws-sdk-go/aws/request" -) - -// DefaultRetryer implements basic retry logic using exponential backoff for -// most services. If you want to implement custom retry logic, implement the -// request.Retryer interface or create a structure type that composes this -// struct and override the specific methods. For example, to override only -// the MaxRetries method: -// -// type retryer struct { -// client.DefaultRetryer -// } -// -// // This implementation always has 100 max retries -// func (d retryer) MaxRetries() int { return 100 } -type DefaultRetryer struct { - NumMaxRetries int -} - -// MaxRetries returns the number of maximum returns the service will use to make -// an individual API request. -func (d DefaultRetryer) MaxRetries() int { - return d.NumMaxRetries -} - -var seededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) - -// RetryRules returns the delay duration before retrying this request again -func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { - // Set the upper limit of delay in retrying at ~five minutes - minTime := 30 - throttle := d.shouldThrottle(r) - if throttle { - minTime = 500 - } - - retryCount := r.RetryCount - if retryCount > 13 { - retryCount = 13 - } else if throttle && retryCount > 8 { - retryCount = 8 - } - - delay := (1 << uint(retryCount)) * (seededRand.Intn(minTime) + minTime) - return time.Duration(delay) * time.Millisecond -} - -// ShouldRetry returns true if the request should be retried. -func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { - // If one of the other handlers already set the retry state - // we don't want to override it based on the service's state - if r.Retryable != nil { - return *r.Retryable - } - - if r.HTTPResponse.StatusCode >= 500 { - return true - } - return r.IsErrorRetryable() || d.shouldThrottle(r) -} - -// ShouldThrottle returns true if the request should be throttled. -func (d DefaultRetryer) shouldThrottle(r *request.Request) bool { - if r.HTTPResponse.StatusCode == 502 || - r.HTTPResponse.StatusCode == 503 || - r.HTTPResponse.StatusCode == 504 { - return true - } - return r.IsErrorThrottle() -} - -// lockedSource is a thread-safe implementation of rand.Source -type lockedSource struct { - lk sync.Mutex - src rand.Source -} - -func (r *lockedSource) Int63() (n int64) { - r.lk.Lock() - n = r.src.Int63() - r.lk.Unlock() - return -} - -func (r *lockedSource) Seed(seed int64) { - r.lk.Lock() - r.src.Seed(seed) - r.lk.Unlock() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go deleted file mode 100644 index 1f39c91f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ /dev/null @@ -1,108 +0,0 @@ -package client - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http/httputil" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -const logReqMsg = `DEBUG: Request %s/%s Details: ----[ REQUEST POST-SIGN ]----------------------------- -%s ------------------------------------------------------` - -const logReqErrMsg = `DEBUG ERROR: Request %s/%s: ----[ REQUEST DUMP ERROR ]----------------------------- -%s -------------------------------------------------------` - -type logWriter struct { - // Logger is what we will use to log the payload of a response. - Logger aws.Logger - // buf stores the contents of what has been read - buf *bytes.Buffer -} - -func (logger *logWriter) Write(b []byte) (int, error) { - return logger.buf.Write(b) -} - -type teeReaderCloser struct { - // io.Reader will be a tee reader that is used during logging. - // This structure will read from a body and write the contents to a logger. - io.Reader - // Source is used just to close when we are done reading. - Source io.ReadCloser -} - -func (reader *teeReaderCloser) Close() error { - return reader.Source.Close() -} - -func logRequest(r *request.Request) { - logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - dumpedBody, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) - if err != nil { - r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } - - if logBody { - // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's - // Body as a NoOpCloser and will not be reset after read by the HTTP - // client reader. - r.ResetBody() - } - - r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ClientInfo.ServiceName, r.Operation.Name, string(dumpedBody))) -} - -const logRespMsg = `DEBUG: Response %s/%s Details: ----[ RESPONSE ]-------------------------------------- -%s ------------------------------------------------------` - -const logRespErrMsg = `DEBUG ERROR: Response %s/%s: ----[ RESPONSE DUMP ERROR ]----------------------------- -%s ------------------------------------------------------` - -func logResponse(r *request.Request) { - lw := &logWriter{r.Config.Logger, bytes.NewBuffer(nil)} - r.HTTPResponse.Body = &teeReaderCloser{ - Reader: io.TeeReader(r.HTTPResponse.Body, lw), - Source: r.HTTPResponse.Body, - } - - handlerFn := func(req *request.Request) { - body, err := httputil.DumpResponse(req.HTTPResponse, false) - if err != nil { - lw.Logger.Log(fmt.Sprintf(logRespErrMsg, req.ClientInfo.ServiceName, req.Operation.Name, err)) - return - } - - b, err := ioutil.ReadAll(lw.buf) - if err != nil { - lw.Logger.Log(fmt.Sprintf(logRespErrMsg, req.ClientInfo.ServiceName, req.Operation.Name, err)) - return - } - lw.Logger.Log(fmt.Sprintf(logRespMsg, req.ClientInfo.ServiceName, req.Operation.Name, string(body))) - if req.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) { - lw.Logger.Log(string(b)) - } - } - - const handlerName = "awsdk.client.LogResponse.ResponseBody" - - r.Handlers.Unmarshal.SetBackNamed(request.NamedHandler{ - Name: handlerName, Fn: handlerFn, - }) - r.Handlers.UnmarshalError.SetBackNamed(request.NamedHandler{ - Name: handlerName, Fn: handlerFn, - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go deleted file mode 100644 index b8d600c9..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package client - -import ( - "bytes" - "io" - "testing" -) - -type mockCloser struct { - closed bool -} - -func (closer *mockCloser) Read(b []byte) (int, error) { - return 0, io.EOF -} - -func (closer *mockCloser) Close() error { - closer.closed = true - return nil -} - -func TestTeeReaderCloser(t *testing.T) { - expected := "FOO" - buf := bytes.NewBuffer([]byte(expected)) - lw := bytes.NewBuffer(nil) - c := &mockCloser{} - closer := teeReaderCloser{ - io.TeeReader(buf, lw), - c, - } - - b := make([]byte, len(expected)) - _, err := closer.Read(b) - closer.Close() - - if expected != lw.String() { - t.Errorf("Expected %q, but received %q", expected, lw.String()) - } - - if err != nil { - t.Errorf("Expected 'nil', but received %v", err) - } - - if !c.closed { - t.Error("Expected 'true', but received 'false'") - } -} - -func TestLogWriter(t *testing.T) { - expected := "FOO" - lw := &logWriter{nil, bytes.NewBuffer(nil)} - lw.Write([]byte(expected)) - - if expected != lw.buf.String() { - t.Errorf("Expected %q, but received %q", expected, lw.buf.String()) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go b/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go deleted file mode 100644 index 4778056d..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go +++ /dev/null @@ -1,12 +0,0 @@ -package metadata - -// ClientInfo wraps immutable data from the client.Client structure. -type ClientInfo struct { - ServiceName string - APIVersion string - Endpoint string - SigningName string - SigningRegion string - JSONVersion string - TargetPrefix string -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go deleted file mode 100644 index ae3a2869..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ /dev/null @@ -1,470 +0,0 @@ -package aws - -import ( - "net/http" - "time" - - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/endpoints" -) - -// UseServiceDefaultRetries instructs the config to use the service's own -// default number of retries. This will be the default action if -// Config.MaxRetries is nil also. -const UseServiceDefaultRetries = -1 - -// RequestRetryer is an alias for a type that implements the request.Retryer -// interface. -type RequestRetryer interface{} - -// A Config provides service configuration for service clients. By default, -// all clients will use the defaults.DefaultConfig tructure. -// -// // Create Session with MaxRetry configuration to be shared by multiple -// // service clients. -// sess := session.Must(session.NewSession(&aws.Config{ -// MaxRetries: aws.Int(3), -// })) -// -// // Create S3 service client with a specific Region. -// svc := s3.New(sess, &aws.Config{ -// Region: aws.String("us-west-2"), -// }) -type Config struct { - // Enables verbose error printing of all credential chain errors. - // Should be used when wanting to see all errors while attempting to - // retrieve credentials. - CredentialsChainVerboseErrors *bool - - // The credentials object to use when signing requests. Defaults to a - // chain of credential providers to search for credentials in environment - // variables, shared credential file, and EC2 Instance Roles. - Credentials *credentials.Credentials - - // An optional endpoint URL (hostname only or fully qualified URI) - // that overrides the default generated endpoint for a client. Set this - // to `""` to use the default generated endpoint. - // - // @note You must still provide a `Region` value when specifying an - // endpoint for a client. - Endpoint *string - - // The resolver to use for looking up endpoints for AWS service clients - // to use based on region. - EndpointResolver endpoints.Resolver - - // EnforceShouldRetryCheck is used in the AfterRetryHandler to always call - // ShouldRetry regardless of whether or not if request.Retryable is set. - // This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck - // is not set, then ShouldRetry will only be called if request.Retryable is nil. - // Proper handling of the request.Retryable field is important when setting this field. - EnforceShouldRetryCheck *bool - - // The region to send requests to. This parameter is required and must - // be configured globally or on a per-client basis unless otherwise - // noted. A full list of regions is found in the "Regions and Endpoints" - // document. - // - // @see http://docs.aws.amazon.com/general/latest/gr/rande.html - // AWS Regions and Endpoints - Region *string - - // Set this to `true` to disable SSL when sending requests. Defaults - // to `false`. - DisableSSL *bool - - // The HTTP client to use when sending requests. Defaults to - // `http.DefaultClient`. - HTTPClient *http.Client - - // An integer value representing the logging level. The default log level - // is zero (LogOff), which represents no logging. To enable logging set - // to a LogLevel Value. - LogLevel *LogLevelType - - // The logger writer interface to write logging messages to. Defaults to - // standard out. - Logger Logger - - // The maximum number of times that a request will be retried for failures. - // Defaults to -1, which defers the max retry setting to the service - // specific configuration. - MaxRetries *int - - // Retryer guides how HTTP requests should be retried in case of - // recoverable failures. - // - // When nil or the value does not implement the request.Retryer interface, - // the client.DefaultRetryer will be used. - // - // When both Retryer and MaxRetries are non-nil, the former is used and - // the latter ignored. - // - // To set the Retryer field in a type-safe manner and with chaining, use - // the request.WithRetryer helper function: - // - // cfg := request.WithRetryer(aws.NewConfig(), myRetryer) - // - Retryer RequestRetryer - - // Disables semantic parameter validation, which validates input for - // missing required fields and/or other semantic request input errors. - DisableParamValidation *bool - - // Disables the computation of request and response checksums, e.g., - // CRC32 checksums in Amazon DynamoDB. - DisableComputeChecksums *bool - - // Set this to `true` to force the request to use path-style addressing, - // i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client - // will use virtual hosted bucket addressing when possible - // (`http://BUCKET.s3.amazonaws.com/KEY`). - // - // @note This configuration option is specific to the Amazon S3 service. - // @see http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html - // Amazon S3: Virtual Hosting of Buckets - S3ForcePathStyle *bool - - // Set this to `true` to disable the SDK adding the `Expect: 100-Continue` - // header to PUT requests over 2MB of content. 100-Continue instructs the - // HTTP client not to send the body until the service responds with a - // `continue` status. This is useful to prevent sending the request body - // until after the request is authenticated, and validated. - // - // http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html - // - // 100-Continue is only enabled for Go 1.6 and above. See `http.Transport`'s - // `ExpectContinueTimeout` for information on adjusting the continue wait - // timeout. https://golang.org/pkg/net/http/#Transport - // - // You should use this flag to disble 100-Continue if you experience issues - // with proxies or third party S3 compatible services. - S3Disable100Continue *bool - - // Set this to `true` to enable S3 Accelerate feature. For all operations - // compatible with S3 Accelerate will use the accelerate endpoint for - // requests. Requests not compatible will fall back to normal S3 requests. - // - // The bucket must be enable for accelerate to be used with S3 client with - // accelerate enabled. If the bucket is not enabled for accelerate an error - // will be returned. The bucket name must be DNS compatible to also work - // with accelerate. - S3UseAccelerate *bool - - // Set this to `true` to disable the EC2Metadata client from overriding the - // default http.Client's Timeout. This is helpful if you do not want the - // EC2Metadata client to create a new http.Client. This options is only - // meaningful if you're not already using a custom HTTP client with the - // SDK. Enabled by default. - // - // Must be set and provided to the session.NewSession() in order to disable - // the EC2Metadata overriding the timeout for default credentials chain. - // - // Example: - // sess := session.Must(session.NewSession(aws.NewConfig() - // .WithEC2MetadataDiableTimeoutOverride(true))) - // - // svc := s3.New(sess) - // - EC2MetadataDisableTimeoutOverride *bool - - // Instructs the endpiont to be generated for a service client to - // be the dual stack endpoint. The dual stack endpoint will support - // both IPv4 and IPv6 addressing. - // - // Setting this for a service which does not support dual stack will fail - // to make requets. It is not recommended to set this value on the session - // as it will apply to all service clients created with the session. Even - // services which don't support dual stack endpoints. - // - // If the Endpoint config value is also provided the UseDualStack flag - // will be ignored. - // - // Only supported with. - // - // sess := session.Must(session.NewSession()) - // - // svc := s3.New(sess, &aws.Config{ - // UseDualStack: aws.Bool(true), - // }) - UseDualStack *bool - - // SleepDelay is an override for the func the SDK will call when sleeping - // during the lifecycle of a request. Specifically this will be used for - // request delays. This value should only be used for testing. To adjust - // the delay of a request see the aws/client.DefaultRetryer and - // aws/request.Retryer. - // - // SleepDelay will prevent any Context from being used for canceling retry - // delay of an API operation. It is recommended to not use SleepDelay at all - // and specify a Retryer instead. - SleepDelay func(time.Duration) - - // DisableRestProtocolURICleaning will not clean the URL path when making rest protocol requests. - // Will default to false. This would only be used for empty directory names in s3 requests. - // - // Example: - // sess := session.Must(session.NewSession(&aws.Config{ - // DisableRestProtocolURICleaning: aws.Bool(true), - // })) - // - // svc := s3.New(sess) - // out, err := svc.GetObject(&s3.GetObjectInput { - // Bucket: aws.String("bucketname"), - // Key: aws.String("//foo//bar//moo"), - // }) - DisableRestProtocolURICleaning *bool -} - -// NewConfig returns a new Config pointer that can be chained with builder -// methods to set multiple configuration values inline without using pointers. -// -// // Create Session with MaxRetry configuration to be shared by multiple -// // service clients. -// sess := session.Must(session.NewSession(aws.NewConfig(). -// WithMaxRetries(3), -// )) -// -// // Create S3 service client with a specific Region. -// svc := s3.New(sess, aws.NewConfig(). -// WithRegion("us-west-2"), -// ) -func NewConfig() *Config { - return &Config{} -} - -// WithCredentialsChainVerboseErrors sets a config verbose errors boolean and returning -// a Config pointer. -func (c *Config) WithCredentialsChainVerboseErrors(verboseErrs bool) *Config { - c.CredentialsChainVerboseErrors = &verboseErrs - return c -} - -// WithCredentials sets a config Credentials value returning a Config pointer -// for chaining. -func (c *Config) WithCredentials(creds *credentials.Credentials) *Config { - c.Credentials = creds - return c -} - -// WithEndpoint sets a config Endpoint value returning a Config pointer for -// chaining. -func (c *Config) WithEndpoint(endpoint string) *Config { - c.Endpoint = &endpoint - return c -} - -// WithEndpointResolver sets a config EndpointResolver value returning a -// Config pointer for chaining. -func (c *Config) WithEndpointResolver(resolver endpoints.Resolver) *Config { - c.EndpointResolver = resolver - return c -} - -// WithRegion sets a config Region value returning a Config pointer for -// chaining. -func (c *Config) WithRegion(region string) *Config { - c.Region = ®ion - return c -} - -// WithDisableSSL sets a config DisableSSL value returning a Config pointer -// for chaining. -func (c *Config) WithDisableSSL(disable bool) *Config { - c.DisableSSL = &disable - return c -} - -// WithHTTPClient sets a config HTTPClient value returning a Config pointer -// for chaining. -func (c *Config) WithHTTPClient(client *http.Client) *Config { - c.HTTPClient = client - return c -} - -// WithMaxRetries sets a config MaxRetries value returning a Config pointer -// for chaining. -func (c *Config) WithMaxRetries(max int) *Config { - c.MaxRetries = &max - return c -} - -// WithDisableParamValidation sets a config DisableParamValidation value -// returning a Config pointer for chaining. -func (c *Config) WithDisableParamValidation(disable bool) *Config { - c.DisableParamValidation = &disable - return c -} - -// WithDisableComputeChecksums sets a config DisableComputeChecksums value -// returning a Config pointer for chaining. -func (c *Config) WithDisableComputeChecksums(disable bool) *Config { - c.DisableComputeChecksums = &disable - return c -} - -// WithLogLevel sets a config LogLevel value returning a Config pointer for -// chaining. -func (c *Config) WithLogLevel(level LogLevelType) *Config { - c.LogLevel = &level - return c -} - -// WithLogger sets a config Logger value returning a Config pointer for -// chaining. -func (c *Config) WithLogger(logger Logger) *Config { - c.Logger = logger - return c -} - -// WithS3ForcePathStyle sets a config S3ForcePathStyle value returning a Config -// pointer for chaining. -func (c *Config) WithS3ForcePathStyle(force bool) *Config { - c.S3ForcePathStyle = &force - return c -} - -// WithS3Disable100Continue sets a config S3Disable100Continue value returning -// a Config pointer for chaining. -func (c *Config) WithS3Disable100Continue(disable bool) *Config { - c.S3Disable100Continue = &disable - return c -} - -// WithS3UseAccelerate sets a config S3UseAccelerate value returning a Config -// pointer for chaining. -func (c *Config) WithS3UseAccelerate(enable bool) *Config { - c.S3UseAccelerate = &enable - return c -} - -// WithUseDualStack sets a config UseDualStack value returning a Config -// pointer for chaining. -func (c *Config) WithUseDualStack(enable bool) *Config { - c.UseDualStack = &enable - return c -} - -// WithEC2MetadataDisableTimeoutOverride sets a config EC2MetadataDisableTimeoutOverride value -// returning a Config pointer for chaining. -func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config { - c.EC2MetadataDisableTimeoutOverride = &enable - return c -} - -// WithSleepDelay overrides the function used to sleep while waiting for the -// next retry. Defaults to time.Sleep. -func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config { - c.SleepDelay = fn - return c -} - -// MergeIn merges the passed in configs into the existing config object. -func (c *Config) MergeIn(cfgs ...*Config) { - for _, other := range cfgs { - mergeInConfig(c, other) - } -} - -func mergeInConfig(dst *Config, other *Config) { - if other == nil { - return - } - - if other.CredentialsChainVerboseErrors != nil { - dst.CredentialsChainVerboseErrors = other.CredentialsChainVerboseErrors - } - - if other.Credentials != nil { - dst.Credentials = other.Credentials - } - - if other.Endpoint != nil { - dst.Endpoint = other.Endpoint - } - - if other.EndpointResolver != nil { - dst.EndpointResolver = other.EndpointResolver - } - - if other.Region != nil { - dst.Region = other.Region - } - - if other.DisableSSL != nil { - dst.DisableSSL = other.DisableSSL - } - - if other.HTTPClient != nil { - dst.HTTPClient = other.HTTPClient - } - - if other.LogLevel != nil { - dst.LogLevel = other.LogLevel - } - - if other.Logger != nil { - dst.Logger = other.Logger - } - - if other.MaxRetries != nil { - dst.MaxRetries = other.MaxRetries - } - - if other.Retryer != nil { - dst.Retryer = other.Retryer - } - - if other.DisableParamValidation != nil { - dst.DisableParamValidation = other.DisableParamValidation - } - - if other.DisableComputeChecksums != nil { - dst.DisableComputeChecksums = other.DisableComputeChecksums - } - - if other.S3ForcePathStyle != nil { - dst.S3ForcePathStyle = other.S3ForcePathStyle - } - - if other.S3Disable100Continue != nil { - dst.S3Disable100Continue = other.S3Disable100Continue - } - - if other.S3UseAccelerate != nil { - dst.S3UseAccelerate = other.S3UseAccelerate - } - - if other.UseDualStack != nil { - dst.UseDualStack = other.UseDualStack - } - - if other.EC2MetadataDisableTimeoutOverride != nil { - dst.EC2MetadataDisableTimeoutOverride = other.EC2MetadataDisableTimeoutOverride - } - - if other.SleepDelay != nil { - dst.SleepDelay = other.SleepDelay - } - - if other.DisableRestProtocolURICleaning != nil { - dst.DisableRestProtocolURICleaning = other.DisableRestProtocolURICleaning - } - - if other.EnforceShouldRetryCheck != nil { - dst.EnforceShouldRetryCheck = other.EnforceShouldRetryCheck - } -} - -// Copy will return a shallow copy of the Config object. If any additional -// configurations are provided they will be merged into the new config returned. -func (c *Config) Copy(cfgs ...*Config) *Config { - dst := &Config{} - dst.MergeIn(c) - - for _, cfg := range cfgs { - dst.MergeIn(cfg) - } - - return dst -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/config_test.go deleted file mode 100644 index fe97a31f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/config_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package aws - -import ( - "net/http" - "reflect" - "testing" - - "github.com/aws/aws-sdk-go/aws/credentials" -) - -var testCredentials = credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - -var copyTestConfig = Config{ - Credentials: testCredentials, - Endpoint: String("CopyTestEndpoint"), - Region: String("COPY_TEST_AWS_REGION"), - DisableSSL: Bool(true), - HTTPClient: http.DefaultClient, - LogLevel: LogLevel(LogDebug), - Logger: NewDefaultLogger(), - MaxRetries: Int(3), - DisableParamValidation: Bool(true), - DisableComputeChecksums: Bool(true), - S3ForcePathStyle: Bool(true), -} - -func TestCopy(t *testing.T) { - want := copyTestConfig - got := copyTestConfig.Copy() - if !reflect.DeepEqual(*got, want) { - t.Errorf("Copy() = %+v", got) - t.Errorf(" want %+v", want) - } - - got.Region = String("other") - if got.Region == want.Region { - t.Errorf("Expect setting copy values not not reflect in source") - } -} - -func TestCopyReturnsNewInstance(t *testing.T) { - want := copyTestConfig - got := copyTestConfig.Copy() - if got == &want { - t.Errorf("Copy() = %p; want different instance as source %p", got, &want) - } -} - -var mergeTestZeroValueConfig = Config{} - -var mergeTestConfig = Config{ - Credentials: testCredentials, - Endpoint: String("MergeTestEndpoint"), - Region: String("MERGE_TEST_AWS_REGION"), - DisableSSL: Bool(true), - HTTPClient: http.DefaultClient, - LogLevel: LogLevel(LogDebug), - Logger: NewDefaultLogger(), - MaxRetries: Int(10), - DisableParamValidation: Bool(true), - DisableComputeChecksums: Bool(true), - S3ForcePathStyle: Bool(true), -} - -var mergeTests = []struct { - cfg *Config - in *Config - want *Config -}{ - {&Config{}, nil, &Config{}}, - {&Config{}, &mergeTestZeroValueConfig, &Config{}}, - {&Config{}, &mergeTestConfig, &mergeTestConfig}, -} - -func TestMerge(t *testing.T) { - for i, tt := range mergeTests { - got := tt.cfg.Copy() - got.MergeIn(tt.in) - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("Config %d %+v", i, tt.cfg) - t.Errorf(" Merge(%+v)", tt.in) - t.Errorf(" got %+v", got) - t.Errorf(" want %+v", tt.want) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context.go b/vendor/github.com/aws/aws-sdk-go/aws/context.go deleted file mode 100644 index 79f42685..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context.go +++ /dev/null @@ -1,71 +0,0 @@ -package aws - -import ( - "time" -) - -// Context is an copy of the Go v1.7 stdlib's context.Context interface. -// It is represented as a SDK interface to enable you to use the "WithContext" -// API methods with Go v1.6 and a Context type such as golang.org/x/net/context. -// -// See https://golang.org/pkg/context on how to use contexts. -type Context interface { - // Deadline returns the time when work done on behalf of this context - // should be canceled. Deadline returns ok==false when no deadline is - // set. Successive calls to Deadline return the same results. - Deadline() (deadline time.Time, ok bool) - - // Done returns a channel that's closed when work done on behalf of this - // context should be canceled. Done may return nil if this context can - // never be canceled. Successive calls to Done return the same value. - Done() <-chan struct{} - - // Err returns a non-nil error value after Done is closed. Err returns - // Canceled if the context was canceled or DeadlineExceeded if the - // context's deadline passed. No other values for Err are defined. - // After Done is closed, successive calls to Err return the same value. - Err() error - - // Value returns the value associated with this context for key, or nil - // if no value is associated with key. Successive calls to Value with - // the same key returns the same result. - // - // Use context values only for request-scoped data that transits - // processes and API boundaries, not for passing optional parameters to - // functions. - Value(key interface{}) interface{} -} - -// BackgroundContext returns a context that will never be canceled, has no -// values, and no deadline. This context is used by the SDK to provide -// backwards compatibility with non-context API operations and functionality. -// -// Go 1.6 and before: -// This context function is equivalent to context.Background in the Go stdlib. -// -// Go 1.7 and later: -// The context returned will be the value returned by context.Background() -// -// See https://golang.org/pkg/context for more information on Contexts. -func BackgroundContext() Context { - return backgroundCtx -} - -// SleepWithContext will wait for the timer duration to expire, or the context -// is canceled. Which ever happens first. If the context is canceled the Context's -// error will be returned. -// -// Expects Context to always return a non-nil error if the Done channel is closed. -func SleepWithContext(ctx Context, dur time.Duration) error { - t := time.NewTimer(dur) - defer t.Stop() - - select { - case <-t.C: - break - case <-ctx.Done(): - return ctx.Err() - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go deleted file mode 100644 index 8fdda530..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go +++ /dev/null @@ -1,41 +0,0 @@ -// +build !go1.7 - -package aws - -import "time" - -// An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to -// provide a 1.6 and 1.5 safe version of context that is compatible with Go -// 1.7's Context. -// -// An emptyCtx is never canceled, has no values, and has no deadline. It is not -// struct{}, since vars of this type must have distinct addresses. -type emptyCtx int - -func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { - return -} - -func (*emptyCtx) Done() <-chan struct{} { - return nil -} - -func (*emptyCtx) Err() error { - return nil -} - -func (*emptyCtx) Value(key interface{}) interface{} { - return nil -} - -func (e *emptyCtx) String() string { - switch e { - case backgroundCtx: - return "aws.BackgroundContext" - } - return "unknown empty Context" -} - -var ( - backgroundCtx = new(emptyCtx) -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go deleted file mode 100644 index 064f75c9..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build go1.7 - -package aws - -import "context" - -var ( - backgroundCtx = context.Background() -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_test.go b/vendor/github.com/aws/aws-sdk-go/aws/context_test.go deleted file mode 100644 index d80a1bb6..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package aws_test - -import ( - "fmt" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting" -) - -func TestSleepWithContext(t *testing.T) { - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - - err := aws.SleepWithContext(ctx, 1*time.Millisecond) - if err != nil { - t.Errorf("expect context to not be canceled, got %v", err) - } -} - -func TestSleepWithContext_Canceled(t *testing.T) { - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - - expectErr := fmt.Errorf("context canceled") - - ctx.Error = expectErr - close(ctx.DoneCh) - - err := aws.SleepWithContext(ctx, 1*time.Millisecond) - if err == nil { - t.Fatalf("expect error, did not get one") - } - - if e, a := expectErr, err; e != a { - t.Errorf("expect %v error, got %v", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go deleted file mode 100644 index ff5d58e0..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go +++ /dev/null @@ -1,387 +0,0 @@ -package aws - -import "time" - -// String returns a pointer to the string value passed in. -func String(v string) *string { - return &v -} - -// StringValue returns the value of the string pointer passed in or -// "" if the pointer is nil. -func StringValue(v *string) string { - if v != nil { - return *v - } - return "" -} - -// StringSlice converts a slice of string values into a slice of -// string pointers -func StringSlice(src []string) []*string { - dst := make([]*string, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// StringValueSlice converts a slice of string pointers into a slice of -// string values -func StringValueSlice(src []*string) []string { - dst := make([]string, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// StringMap converts a string map of string values into a string -// map of string pointers -func StringMap(src map[string]string) map[string]*string { - dst := make(map[string]*string) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// StringValueMap converts a string map of string pointers into a string -// map of string values -func StringValueMap(src map[string]*string) map[string]string { - dst := make(map[string]string) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Bool returns a pointer to the bool value passed in. -func Bool(v bool) *bool { - return &v -} - -// BoolValue returns the value of the bool pointer passed in or -// false if the pointer is nil. -func BoolValue(v *bool) bool { - if v != nil { - return *v - } - return false -} - -// BoolSlice converts a slice of bool values into a slice of -// bool pointers -func BoolSlice(src []bool) []*bool { - dst := make([]*bool, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// BoolValueSlice converts a slice of bool pointers into a slice of -// bool values -func BoolValueSlice(src []*bool) []bool { - dst := make([]bool, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// BoolMap converts a string map of bool values into a string -// map of bool pointers -func BoolMap(src map[string]bool) map[string]*bool { - dst := make(map[string]*bool) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// BoolValueMap converts a string map of bool pointers into a string -// map of bool values -func BoolValueMap(src map[string]*bool) map[string]bool { - dst := make(map[string]bool) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int returns a pointer to the int value passed in. -func Int(v int) *int { - return &v -} - -// IntValue returns the value of the int pointer passed in or -// 0 if the pointer is nil. -func IntValue(v *int) int { - if v != nil { - return *v - } - return 0 -} - -// IntSlice converts a slice of int values into a slice of -// int pointers -func IntSlice(src []int) []*int { - dst := make([]*int, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// IntValueSlice converts a slice of int pointers into a slice of -// int values -func IntValueSlice(src []*int) []int { - dst := make([]int, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// IntMap converts a string map of int values into a string -// map of int pointers -func IntMap(src map[string]int) map[string]*int { - dst := make(map[string]*int) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// IntValueMap converts a string map of int pointers into a string -// map of int values -func IntValueMap(src map[string]*int) map[string]int { - dst := make(map[string]int) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int64 returns a pointer to the int64 value passed in. -func Int64(v int64) *int64 { - return &v -} - -// Int64Value returns the value of the int64 pointer passed in or -// 0 if the pointer is nil. -func Int64Value(v *int64) int64 { - if v != nil { - return *v - } - return 0 -} - -// Int64Slice converts a slice of int64 values into a slice of -// int64 pointers -func Int64Slice(src []int64) []*int64 { - dst := make([]*int64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int64ValueSlice converts a slice of int64 pointers into a slice of -// int64 values -func Int64ValueSlice(src []*int64) []int64 { - dst := make([]int64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int64Map converts a string map of int64 values into a string -// map of int64 pointers -func Int64Map(src map[string]int64) map[string]*int64 { - dst := make(map[string]*int64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int64ValueMap converts a string map of int64 pointers into a string -// map of int64 values -func Int64ValueMap(src map[string]*int64) map[string]int64 { - dst := make(map[string]int64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Float64 returns a pointer to the float64 value passed in. -func Float64(v float64) *float64 { - return &v -} - -// Float64Value returns the value of the float64 pointer passed in or -// 0 if the pointer is nil. -func Float64Value(v *float64) float64 { - if v != nil { - return *v - } - return 0 -} - -// Float64Slice converts a slice of float64 values into a slice of -// float64 pointers -func Float64Slice(src []float64) []*float64 { - dst := make([]*float64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Float64ValueSlice converts a slice of float64 pointers into a slice of -// float64 values -func Float64ValueSlice(src []*float64) []float64 { - dst := make([]float64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Float64Map converts a string map of float64 values into a string -// map of float64 pointers -func Float64Map(src map[string]float64) map[string]*float64 { - dst := make(map[string]*float64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Float64ValueMap converts a string map of float64 pointers into a string -// map of float64 values -func Float64ValueMap(src map[string]*float64) map[string]float64 { - dst := make(map[string]float64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Time returns a pointer to the time.Time value passed in. -func Time(v time.Time) *time.Time { - return &v -} - -// TimeValue returns the value of the time.Time pointer passed in or -// time.Time{} if the pointer is nil. -func TimeValue(v *time.Time) time.Time { - if v != nil { - return *v - } - return time.Time{} -} - -// SecondsTimeValue converts an int64 pointer to a time.Time value -// representing seconds since Epoch or time.Time{} if the pointer is nil. -func SecondsTimeValue(v *int64) time.Time { - if v != nil { - return time.Unix((*v / 1000), 0) - } - return time.Time{} -} - -// MillisecondsTimeValue converts an int64 pointer to a time.Time value -// representing milliseconds sinch Epoch or time.Time{} if the pointer is nil. -func MillisecondsTimeValue(v *int64) time.Time { - if v != nil { - return time.Unix(0, (*v * 1000000)) - } - return time.Time{} -} - -// TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". -// The result is undefined if the Unix time cannot be represented by an int64. -// Which includes calling TimeUnixMilli on a zero Time is undefined. -// -// This utility is useful for service API's such as CloudWatch Logs which require -// their unix time values to be in milliseconds. -// -// See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information. -func TimeUnixMilli(t time.Time) int64 { - return t.UnixNano() / int64(time.Millisecond/time.Nanosecond) -} - -// TimeSlice converts a slice of time.Time values into a slice of -// time.Time pointers -func TimeSlice(src []time.Time) []*time.Time { - dst := make([]*time.Time, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// TimeValueSlice converts a slice of time.Time pointers into a slice of -// time.Time values -func TimeValueSlice(src []*time.Time) []time.Time { - dst := make([]time.Time, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// TimeMap converts a string map of time.Time values into a string -// map of time.Time pointers -func TimeMap(src map[string]time.Time) map[string]*time.Time { - dst := make(map[string]*time.Time) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// TimeValueMap converts a string map of time.Time pointers into a string -// map of time.Time values -func TimeValueMap(src map[string]*time.Time) map[string]time.Time { - dst := make(map[string]time.Time) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go deleted file mode 100644 index 1a9461e1..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types_test.go +++ /dev/null @@ -1,641 +0,0 @@ -package aws - -import ( - "reflect" - "testing" - "time" -) - -var testCasesStringSlice = [][]string{ - {"a", "b", "c", "d", "e"}, - {"a", "b", "", "", "e"}, -} - -func TestStringSlice(t *testing.T) { - for idx, in := range testCasesStringSlice { - if in == nil { - continue - } - out := StringSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := StringValueSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesStringValueSlice = [][]*string{ - {String("a"), String("b"), nil, String("c")}, -} - -func TestStringValueSlice(t *testing.T) { - for idx, in := range testCasesStringValueSlice { - if in == nil { - continue - } - out := StringValueSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if in[i] == nil { - if out[i] != "" { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := *(in[i]), out[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - - out2 := StringSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out2 { - if in[i] == nil { - if *(out2[i]) != "" { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := *in[i], *out2[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - } -} - -var testCasesStringMap = []map[string]string{ - {"a": "1", "b": "2", "c": "3"}, -} - -func TestStringMap(t *testing.T) { - for idx, in := range testCasesStringMap { - if in == nil { - continue - } - out := StringMap(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := StringValueMap(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesBoolSlice = [][]bool{ - {true, true, false, false}, -} - -func TestBoolSlice(t *testing.T) { - for idx, in := range testCasesBoolSlice { - if in == nil { - continue - } - out := BoolSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := BoolValueSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesBoolValueSlice = [][]*bool{} - -func TestBoolValueSlice(t *testing.T) { - for idx, in := range testCasesBoolValueSlice { - if in == nil { - continue - } - out := BoolValueSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if in[i] == nil { - if out[i] { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := *(in[i]), out[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - - out2 := BoolSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out2 { - if in[i] == nil { - if *(out2[i]) { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := in[i], out2[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - } -} - -var testCasesBoolMap = []map[string]bool{ - {"a": true, "b": false, "c": true}, -} - -func TestBoolMap(t *testing.T) { - for idx, in := range testCasesBoolMap { - if in == nil { - continue - } - out := BoolMap(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := BoolValueMap(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesIntSlice = [][]int{ - {1, 2, 3, 4}, -} - -func TestIntSlice(t *testing.T) { - for idx, in := range testCasesIntSlice { - if in == nil { - continue - } - out := IntSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := IntValueSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesIntValueSlice = [][]*int{} - -func TestIntValueSlice(t *testing.T) { - for idx, in := range testCasesIntValueSlice { - if in == nil { - continue - } - out := IntValueSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if in[i] == nil { - if out[i] != 0 { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := *(in[i]), out[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - - out2 := IntSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out2 { - if in[i] == nil { - if *(out2[i]) != 0 { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := in[i], out2[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - } -} - -var testCasesIntMap = []map[string]int{ - {"a": 3, "b": 2, "c": 1}, -} - -func TestIntMap(t *testing.T) { - for idx, in := range testCasesIntMap { - if in == nil { - continue - } - out := IntMap(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := IntValueMap(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesInt64Slice = [][]int64{ - {1, 2, 3, 4}, -} - -func TestInt64Slice(t *testing.T) { - for idx, in := range testCasesInt64Slice { - if in == nil { - continue - } - out := Int64Slice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := Int64ValueSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesInt64ValueSlice = [][]*int64{} - -func TestInt64ValueSlice(t *testing.T) { - for idx, in := range testCasesInt64ValueSlice { - if in == nil { - continue - } - out := Int64ValueSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if in[i] == nil { - if out[i] != 0 { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := *(in[i]), out[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - - out2 := Int64Slice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out2 { - if in[i] == nil { - if *(out2[i]) != 0 { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := in[i], out2[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - } -} - -var testCasesInt64Map = []map[string]int64{ - {"a": 3, "b": 2, "c": 1}, -} - -func TestInt64Map(t *testing.T) { - for idx, in := range testCasesInt64Map { - if in == nil { - continue - } - out := Int64Map(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := Int64ValueMap(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesFloat64Slice = [][]float64{ - {1, 2, 3, 4}, -} - -func TestFloat64Slice(t *testing.T) { - for idx, in := range testCasesFloat64Slice { - if in == nil { - continue - } - out := Float64Slice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := Float64ValueSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesFloat64ValueSlice = [][]*float64{} - -func TestFloat64ValueSlice(t *testing.T) { - for idx, in := range testCasesFloat64ValueSlice { - if in == nil { - continue - } - out := Float64ValueSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if in[i] == nil { - if out[i] != 0 { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := *(in[i]), out[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - - out2 := Float64Slice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out2 { - if in[i] == nil { - if *(out2[i]) != 0 { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := in[i], out2[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - } -} - -var testCasesFloat64Map = []map[string]float64{ - {"a": 3, "b": 2, "c": 1}, -} - -func TestFloat64Map(t *testing.T) { - for idx, in := range testCasesFloat64Map { - if in == nil { - continue - } - out := Float64Map(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := Float64ValueMap(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesTimeSlice = [][]time.Time{ - {time.Now(), time.Now().AddDate(100, 0, 0)}, -} - -func TestTimeSlice(t *testing.T) { - for idx, in := range testCasesTimeSlice { - if in == nil { - continue - } - out := TimeSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := TimeValueSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -var testCasesTimeValueSlice = [][]*time.Time{} - -func TestTimeValueSlice(t *testing.T) { - for idx, in := range testCasesTimeValueSlice { - if in == nil { - continue - } - out := TimeValueSlice(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if in[i] == nil { - if !out[i].IsZero() { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := *(in[i]), out[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - - out2 := TimeSlice(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out2 { - if in[i] == nil { - if !(*(out2[i])).IsZero() { - t.Errorf("Unexpected value at idx %d", idx) - } - } else { - if e, a := in[i], out2[i]; e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - } - } -} - -var testCasesTimeMap = []map[string]time.Time{ - {"a": time.Now().AddDate(-100, 0, 0), "b": time.Now()}, -} - -func TestTimeMap(t *testing.T) { - for idx, in := range testCasesTimeMap { - if in == nil { - continue - } - out := TimeMap(in) - if e, a := len(out), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - for i := range out { - if e, a := in[i], *(out[i]); e != a { - t.Errorf("Unexpected value at idx %d", idx) - } - } - - out2 := TimeValueMap(out) - if e, a := len(out2), len(in); e != a { - t.Errorf("Unexpected len at idx %d", idx) - } - if e, a := in, out2; !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected value at idx %d", idx) - } - } -} - -type TimeValueTestCase struct { - in int64 - outSecs time.Time - outMillis time.Time -} - -var testCasesTimeValue = []TimeValueTestCase{ - { - in: int64(1501558289000), - outSecs: time.Unix(1501558289, 0), - outMillis: time.Unix(1501558289, 0), - }, - { - in: int64(1501558289001), - outSecs: time.Unix(1501558289, 0), - outMillis: time.Unix(1501558289, 1*1000000), - }, -} - -func TestSecondsTimeValue(t *testing.T) { - for idx, testCase := range testCasesTimeValue { - out := SecondsTimeValue(&testCase.in) - if e, a := testCase.outSecs, out; e != a { - t.Errorf("Unexpected value for time value at %d", idx) - } - } -} - -func TestMillisecondsTimeValue(t *testing.T) { - for idx, testCase := range testCasesTimeValue { - out := MillisecondsTimeValue(&testCase.in) - if e, a := testCase.outMillis, out; e != a { - t.Errorf("Unexpected value for time value at %d", idx) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go deleted file mode 100644 index 495e3ef6..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ /dev/null @@ -1,242 +0,0 @@ -package corehandlers - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "regexp" - "runtime" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" -) - -// Interface for matching types which also have a Len method. -type lener interface { - Len() int -} - -// BuildContentLengthHandler builds the content length of a request based on the body, -// or will use the HTTPRequest.Header's "Content-Length" if defined. If unable -// to determine request body length and no "Content-Length" was specified it will panic. -// -// The Content-Length will only be added to the request if the length of the body -// is greater than 0. If the body is empty or the current `Content-Length` -// header is <= 0, the header will also be stripped. -var BuildContentLengthHandler = request.NamedHandler{Name: "core.BuildContentLengthHandler", Fn: func(r *request.Request) { - var length int64 - - if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { - length, _ = strconv.ParseInt(slength, 10, 64) - } else { - switch body := r.Body.(type) { - case nil: - length = 0 - case lener: - length = int64(body.Len()) - case io.Seeker: - r.BodyStart, _ = body.Seek(0, 1) - end, _ := body.Seek(0, 2) - body.Seek(r.BodyStart, 0) // make sure to seek back to original location - length = end - r.BodyStart - default: - panic("Cannot get length of body, must provide `ContentLength`") - } - } - - if length > 0 { - r.HTTPRequest.ContentLength = length - r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) - } else { - r.HTTPRequest.ContentLength = 0 - r.HTTPRequest.Header.Del("Content-Length") - } -}} - -// SDKVersionUserAgentHandler is a request handler for adding the SDK Version to the user agent. -var SDKVersionUserAgentHandler = request.NamedHandler{ - Name: "core.SDKVersionUserAgentHandler", - Fn: request.MakeAddToUserAgentHandler(aws.SDKName, aws.SDKVersion, - runtime.Version(), runtime.GOOS, runtime.GOARCH), -} - -var reStatusCode = regexp.MustCompile(`^(\d{3})`) - -// ValidateReqSigHandler is a request handler to ensure that the request's -// signature doesn't expire before it is sent. This can happen when a request -// is built and signed significantly before it is sent. Or significant delays -// occur when retrying requests that would cause the signature to expire. -var ValidateReqSigHandler = request.NamedHandler{ - Name: "core.ValidateReqSigHandler", - Fn: func(r *request.Request) { - // Unsigned requests are not signed - if r.Config.Credentials == credentials.AnonymousCredentials { - return - } - - signedTime := r.Time - if !r.LastSignedAt.IsZero() { - signedTime = r.LastSignedAt - } - - // 10 minutes to allow for some clock skew/delays in transmission. - // Would be improved with aws/aws-sdk-go#423 - if signedTime.Add(10 * time.Minute).After(time.Now()) { - return - } - - fmt.Println("request expired, resigning") - r.Sign() - }, -} - -// SendHandler is a request handler to send service request using HTTP client. -var SendHandler = request.NamedHandler{ - Name: "core.SendHandler", - Fn: func(r *request.Request) { - sender := sendFollowRedirects - if r.DisableFollowRedirects { - sender = sendWithoutFollowRedirects - } - - if request.NoBody == r.HTTPRequest.Body { - // Strip off the request body if the NoBody reader was used as a - // place holder for a request body. This prevents the SDK from - // making requests with a request body when it would be invalid - // to do so. - // - // Use a shallow copy of the http.Request to ensure the race condition - // of transport on Body will not trigger - reqOrig, reqCopy := r.HTTPRequest, *r.HTTPRequest - reqCopy.Body = nil - r.HTTPRequest = &reqCopy - defer func() { - r.HTTPRequest = reqOrig - }() - } - - var err error - r.HTTPResponse, err = sender(r) - if err != nil { - handleSendError(r, err) - } - }, -} - -func sendFollowRedirects(r *request.Request) (*http.Response, error) { - return r.Config.HTTPClient.Do(r.HTTPRequest) -} - -func sendWithoutFollowRedirects(r *request.Request) (*http.Response, error) { - transport := r.Config.HTTPClient.Transport - if transport == nil { - transport = http.DefaultTransport - } - - return transport.RoundTrip(r.HTTPRequest) -} - -func handleSendError(r *request.Request, err error) { - // Prevent leaking if an HTTPResponse was returned. Clean up - // the body. - if r.HTTPResponse != nil { - r.HTTPResponse.Body.Close() - } - // Capture the case where url.Error is returned for error processing - // response. e.g. 301 without location header comes back as string - // error and r.HTTPResponse is nil. Other URL redirect errors will - // comeback in a similar method. - if e, ok := err.(*url.Error); ok && e.Err != nil { - if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { - code, _ := strconv.ParseInt(s[1], 10, 64) - r.HTTPResponse = &http.Response{ - StatusCode: int(code), - Status: http.StatusText(int(code)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - return - } - } - if r.HTTPResponse == nil { - // Add a dummy request response object to ensure the HTTPResponse - // value is consistent. - r.HTTPResponse = &http.Response{ - StatusCode: int(0), - Status: http.StatusText(int(0)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - } - // Catch all other request errors. - r.Error = awserr.New("RequestError", "send request failed", err) - r.Retryable = aws.Bool(true) // network errors are retryable - - // Override the error with a context canceled error, if that was canceled. - ctx := r.Context() - select { - case <-ctx.Done(): - r.Error = awserr.New(request.CanceledErrorCode, - "request context canceled", ctx.Err()) - r.Retryable = aws.Bool(false) - default: - } -} - -// ValidateResponseHandler is a request handler to validate service response. -var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseHandler", Fn: func(r *request.Request) { - if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 300 { - // this may be replaced by an UnmarshalError handler - r.Error = awserr.New("UnknownError", "unknown error", nil) - } -}} - -// AfterRetryHandler performs final checks to determine if the request should -// be retried and how long to delay. -var AfterRetryHandler = request.NamedHandler{Name: "core.AfterRetryHandler", Fn: func(r *request.Request) { - // If one of the other handlers already set the retry state - // we don't want to override it based on the service's state - if r.Retryable == nil || aws.BoolValue(r.Config.EnforceShouldRetryCheck) { - r.Retryable = aws.Bool(r.ShouldRetry(r)) - } - - if r.WillRetry() { - r.RetryDelay = r.RetryRules(r) - - if sleepFn := r.Config.SleepDelay; sleepFn != nil { - // Support SleepDelay for backwards compatibility and testing - sleepFn(r.RetryDelay) - } else if err := aws.SleepWithContext(r.Context(), r.RetryDelay); err != nil { - r.Error = awserr.New(request.CanceledErrorCode, - "request context canceled", err) - r.Retryable = aws.Bool(false) - return - } - - // when the expired token exception occurs the credentials - // need to be expired locally so that the next request to - // get credentials will trigger a credentials refresh. - if r.IsErrorExpired() { - r.Config.Credentials.Expire() - } - - r.RetryCount++ - r.Error = nil - } -}} - -// ValidateEndpointHandler is a request handler to validate a request had the -// appropriate Region and Endpoint set. Will set r.Error if the endpoint or -// region is not valid. -var ValidateEndpointHandler = request.NamedHandler{Name: "core.ValidateEndpointHandler", Fn: func(r *request.Request) { - if r.ClientInfo.SigningRegion == "" && aws.StringValue(r.Config.Region) == "" { - r.Error = aws.ErrMissingRegion - } else if r.ClientInfo.Endpoint == "" { - r.Error = aws.ErrMissingEndpoint - } -}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go deleted file mode 100644 index b47afc24..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// +build go1.8 - -package corehandlers_test - -import ( - "crypto/tls" - "net/http" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "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/awstesting" - "github.com/aws/aws-sdk-go/service/s3" - "golang.org/x/net/http2" -) - -func TestSendHandler_HEADNoBody(t *testing.T) { - TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err := awstesting.CreateTLSBundleFiles() - if err != nil { - panic(err) - } - defer awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile) - - endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - transport := http.DefaultTransport.(*http.Transport) - // test server's certificate is self-signed certificate - transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} - http2.ConfigureTransport(transport) - - sess, err := session.NewSessionWithOptions(session.Options{ - Config: aws.Config{ - HTTPClient: &http.Client{}, - Endpoint: aws.String(endpoint), - Region: aws.String("mock-region"), - Credentials: credentials.AnonymousCredentials, - S3ForcePathStyle: aws.Bool(true), - }, - }) - - svc := s3.New(sess) - - req, _ := svc.HeadObjectRequest(&s3.HeadObjectInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("keyname"), - }) - - if e, a := request.NoBody, req.HTTPRequest.Body; e != a { - t.Fatalf("expect %T request body, got %T", e, a) - } - - err = req.Send() - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if e, a := http.StatusOK, req.HTTPResponse.StatusCode; e != a { - t.Errorf("expect %d status code, got %d", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go deleted file mode 100644 index 1d715c9f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go +++ /dev/null @@ -1,398 +0,0 @@ -package corehandlers_test - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - "os" - "strings" - "testing" - "time" - - "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/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -func TestValidateEndpointHandler(t *testing.T) { - os.Clearenv() - - svc := awstesting.NewClient(aws.NewConfig().WithRegion("us-west-2")) - svc.Handlers.Clear() - svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) - - req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - if err != nil { - t.Errorf("expect no error, got %v", err) - } -} - -func TestValidateEndpointHandlerErrorRegion(t *testing.T) { - os.Clearenv() - - svc := awstesting.NewClient() - svc.Handlers.Clear() - svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) - - req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - if err == nil { - t.Errorf("expect error, got none") - } - if e, a := aws.ErrMissingRegion, err; e != a { - t.Errorf("expect %v to be %v", e, a) - } -} - -type mockCredsProvider struct { - expired bool - retrieveCalled bool -} - -func (m *mockCredsProvider) Retrieve() (credentials.Value, error) { - m.retrieveCalled = true - return credentials.Value{ProviderName: "mockCredsProvider"}, nil -} - -func (m *mockCredsProvider) IsExpired() bool { - return m.expired -} - -func TestAfterRetryRefreshCreds(t *testing.T) { - os.Clearenv() - credProvider := &mockCredsProvider{} - - svc := awstesting.NewClient(&aws.Config{ - Credentials: credentials.NewCredentials(credProvider), - MaxRetries: aws.Int(1), - }) - - svc.Handlers.Clear() - svc.Handlers.ValidateResponse.PushBack(func(r *request.Request) { - r.Error = awserr.New("UnknownError", "", nil) - r.HTTPResponse = &http.Response{StatusCode: 400, Body: ioutil.NopCloser(bytes.NewBuffer([]byte{}))} - }) - svc.Handlers.UnmarshalError.PushBack(func(r *request.Request) { - r.Error = awserr.New("ExpiredTokenException", "", nil) - }) - svc.Handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) - - if !svc.Config.Credentials.IsExpired() { - t.Errorf("Expect to start out expired") - } - if credProvider.retrieveCalled { - t.Errorf("expect not called") - } - - req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - req.Send() - - if !svc.Config.Credentials.IsExpired() { - t.Errorf("Expect to start out expired") - } - if credProvider.retrieveCalled { - t.Errorf("expect not called") - } - - _, err := svc.Config.Credentials.Get() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if !credProvider.retrieveCalled { - t.Errorf("expect not called") - } -} - -func TestAfterRetryWithContextCanceled(t *testing.T) { - c := awstesting.NewClient() - - req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)} - req.SetContext(ctx) - - req.Error = fmt.Errorf("some error") - req.Retryable = aws.Bool(true) - req.HTTPResponse = &http.Response{ - StatusCode: 500, - } - - close(ctx.DoneCh) - ctx.Error = fmt.Errorf("context canceled") - - corehandlers.AfterRetryHandler.Fn(req) - - if req.Error == nil { - t.Fatalf("expect error but didn't receive one") - } - - aerr := req.Error.(awserr.Error) - - if e, a := request.CanceledErrorCode, aerr.Code(); e != a { - t.Errorf("expect %q, error code got %q", e, a) - } -} - -func TestAfterRetryWithContext(t *testing.T) { - c := awstesting.NewClient() - - req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)} - req.SetContext(ctx) - - req.Error = fmt.Errorf("some error") - req.Retryable = aws.Bool(true) - req.HTTPResponse = &http.Response{ - StatusCode: 500, - } - - corehandlers.AfterRetryHandler.Fn(req) - - if req.Error != nil { - t.Fatalf("expect no error, got %v", req.Error) - } - if e, a := 1, req.RetryCount; e != a { - t.Errorf("expect retry count to be %d, got %d", e, a) - } -} - -func TestSendWithContextCanceled(t *testing.T) { - c := awstesting.NewClient(&aws.Config{ - SleepDelay: func(dur time.Duration) { - t.Errorf("SleepDelay should not be called") - }, - }) - - req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{}, 0)} - req.SetContext(ctx) - - req.Error = fmt.Errorf("some error") - req.Retryable = aws.Bool(true) - req.HTTPResponse = &http.Response{ - StatusCode: 500, - } - - close(ctx.DoneCh) - ctx.Error = fmt.Errorf("context canceled") - - corehandlers.SendHandler.Fn(req) - - if req.Error == nil { - t.Fatalf("expect error but didn't receive one") - } - - aerr := req.Error.(awserr.Error) - - if e, a := request.CanceledErrorCode, aerr.Code(); e != a { - t.Errorf("expect %q, error code got %q", e, a) - } -} - -type testSendHandlerTransport struct{} - -func (t *testSendHandlerTransport) RoundTrip(r *http.Request) (*http.Response, error) { - return nil, fmt.Errorf("mock error") -} - -func TestSendHandlerError(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{ - HTTPClient: &http.Client{ - Transport: &testSendHandlerTransport{}, - }, - }) - svc.Handlers.Clear() - svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) - r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - - r.Send() - - if r.Error == nil { - t.Errorf("expect error, got none") - } - if r.HTTPResponse == nil { - t.Errorf("expect response, got none") - } -} - -func TestSendWithoutFollowRedirects(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/original": - w.Header().Set("Location", "/redirected") - w.WriteHeader(301) - case "/redirected": - t.Fatalf("expect not to redirect, but was") - } - })) - - svc := awstesting.NewClient(&aws.Config{ - DisableSSL: aws.Bool(true), - Endpoint: aws.String(server.URL), - }) - svc.Handlers.Clear() - svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) - - r := svc.NewRequest(&request.Operation{ - Name: "Operation", - HTTPPath: "/original", - }, nil, nil) - r.DisableFollowRedirects = true - - err := r.Send() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := 301, r.HTTPResponse.StatusCode; e != a { - t.Errorf("expect %d status code, got %d", e, a) - } -} - -func TestValidateReqSigHandler(t *testing.T) { - cases := []struct { - Req *request.Request - Resign bool - }{ - { - Req: &request.Request{ - Config: aws.Config{Credentials: credentials.AnonymousCredentials}, - Time: time.Now().Add(-15 * time.Minute), - }, - Resign: false, - }, - { - Req: &request.Request{ - Time: time.Now().Add(-15 * time.Minute), - }, - Resign: true, - }, - { - Req: &request.Request{ - Time: time.Now().Add(-1 * time.Minute), - }, - Resign: false, - }, - } - - for i, c := range cases { - resigned := false - c.Req.Handlers.Sign.PushBack(func(r *request.Request) { - resigned = true - }) - - corehandlers.ValidateReqSigHandler.Fn(c.Req) - - if c.Req.Error != nil { - t.Errorf("expect no error, got %v", c.Req.Error) - } - if e, a := c.Resign, resigned; e != a { - t.Errorf("%d, expect %v to be %v", i, e, a) - } - } -} - -func setupContentLengthTestServer(t *testing.T, hasContentLength bool, contentLength int64) *httptest.Server { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - _, ok := r.Header["Content-Length"] - if e, a := hasContentLength, ok; e != a { - t.Errorf("expect %v to be %v", e, a) - } - if hasContentLength { - if e, a := contentLength, r.ContentLength; e != a { - t.Errorf("expect %v to be %v", e, a) - } - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Errorf("expect no error, got %v", err) - } - r.Body.Close() - - authHeader := r.Header.Get("Authorization") - if hasContentLength { - if e, a := "content-length", authHeader; !strings.Contains(a, e) { - t.Errorf("expect %v to be in %v", e, a) - } - } else { - if e, a := "content-length", authHeader; strings.Contains(a, e) { - t.Errorf("expect %v to not be in %v", e, a) - } - } - - if e, a := contentLength, int64(len(b)); e != a { - t.Errorf("expect %v to be %v", e, a) - } - })) - - return server -} - -func TestBuildContentLength_ZeroBody(t *testing.T) { - server := setupContentLengthTestServer(t, false, 0) - - svc := s3.New(unit.Session, &aws.Config{ - Endpoint: aws.String(server.URL), - S3ForcePathStyle: aws.Bool(true), - DisableSSL: aws.Bool(true), - }) - _, err := svc.GetObject(&s3.GetObjectInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("keyname"), - }) - - if err != nil { - t.Errorf("expect no error, got %v", err) - } -} - -func TestBuildContentLength_NegativeBody(t *testing.T) { - server := setupContentLengthTestServer(t, false, 0) - - svc := s3.New(unit.Session, &aws.Config{ - Endpoint: aws.String(server.URL), - S3ForcePathStyle: aws.Bool(true), - DisableSSL: aws.Bool(true), - }) - req, _ := svc.GetObjectRequest(&s3.GetObjectInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("keyname"), - }) - - req.HTTPRequest.Header.Set("Content-Length", "-1") - - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } -} - -func TestBuildContentLength_WithBody(t *testing.T) { - server := setupContentLengthTestServer(t, true, 1024) - - svc := s3.New(unit.Session, &aws.Config{ - Endpoint: aws.String(server.URL), - S3ForcePathStyle: aws.Bool(true), - DisableSSL: aws.Bool(true), - }) - _, err := svc.PutObject(&s3.PutObjectInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("keyname"), - Body: bytes.NewReader(make([]byte, 1024)), - }) - - if err != nil { - t.Errorf("expect no error, got %v", err) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go deleted file mode 100644 index 7d50b155..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go +++ /dev/null @@ -1,17 +0,0 @@ -package corehandlers - -import "github.com/aws/aws-sdk-go/aws/request" - -// ValidateParametersHandler is a request handler to validate the input parameters. -// Validating parameters only has meaning if done prior to the request being sent. -var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { - if !r.ParamsFilled() { - return - } - - if v, ok := r.Params.(request.Validator); ok { - if err := v.Validate(); err != nil { - r.Error = err - } - } -}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go deleted file mode 100644 index e1d8a08f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go +++ /dev/null @@ -1,286 +0,0 @@ -package corehandlers_test - -import ( - "fmt" - "testing" - "reflect" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/kinesis" -) - -var testSvc = func() *client.Client { - s := &client.Client{ - Config: aws.Config{}, - ClientInfo: metadata.ClientInfo{ - ServiceName: "mock-service", - APIVersion: "2015-01-01", - }, - } - return s -}() - -type StructShape struct { - _ struct{} `type:"structure"` - - RequiredList []*ConditionalStructShape `required:"true"` - RequiredMap map[string]*ConditionalStructShape `required:"true"` - RequiredBool *bool `required:"true"` - OptionalStruct *ConditionalStructShape - - hiddenParameter *string -} - -func (s *StructShape) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "StructShape"} - if s.RequiredList == nil { - invalidParams.Add(request.NewErrParamRequired("RequiredList")) - } - if s.RequiredMap == nil { - invalidParams.Add(request.NewErrParamRequired("RequiredMap")) - } - if s.RequiredBool == nil { - invalidParams.Add(request.NewErrParamRequired("RequiredBool")) - } - if s.RequiredList != nil { - for i, v := range s.RequiredList { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RequiredList", i), err.(request.ErrInvalidParams)) - } - } - } - if s.RequiredMap != nil { - for i, v := range s.RequiredMap { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RequiredMap", i), err.(request.ErrInvalidParams)) - } - } - } - if s.OptionalStruct != nil { - if err := s.OptionalStruct.Validate(); err != nil { - invalidParams.AddNested("OptionalStruct", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -type ConditionalStructShape struct { - _ struct{} `type:"structure"` - - Name *string `required:"true"` -} - -func (s *ConditionalStructShape) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ConditionalStructShape"} - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -func TestNoErrors(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{}, - RequiredMap: map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {Name: aws.String("Name")}, - }, - RequiredBool: aws.Bool(true), - OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")}, - } - - req := testSvc.NewRequest(&request.Operation{}, input, nil) - corehandlers.ValidateParametersHandler.Fn(req) - if req.Error != nil { - t.Fatalf("expect no error, got %v", req.Error) - } -} - -func TestMissingRequiredParameters(t *testing.T) { - input := &StructShape{} - req := testSvc.NewRequest(&request.Operation{}, input, nil) - corehandlers.ValidateParametersHandler.Fn(req) - - if req.Error == nil { - t.Fatalf("expect error") - } - if e, a := "InvalidParameter", req.Error.(awserr.Error).Code(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "3 validation error(s) found.", req.Error.(awserr.Error).Message(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - errs := req.Error.(awserr.BatchedErrors).OrigErrs() - if e, a := 3, len(errs); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "ParamRequiredError: missing required field, StructShape.RequiredList.", errs[0].Error(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "ParamRequiredError: missing required field, StructShape.RequiredMap.", errs[1].Error(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "ParamRequiredError: missing required field, StructShape.RequiredBool.", errs[2].Error(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - if e, a := "InvalidParameter: 3 validation error(s) found.\n- missing required field, StructShape.RequiredList.\n- missing required field, StructShape.RequiredMap.\n- missing required field, StructShape.RequiredBool.\n", req.Error.Error(); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestNestedMissingRequiredParameters(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{{}}, - RequiredMap: map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {}, - }, - RequiredBool: aws.Bool(true), - OptionalStruct: &ConditionalStructShape{}, - } - - req := testSvc.NewRequest(&request.Operation{}, input, nil) - corehandlers.ValidateParametersHandler.Fn(req) - - if req.Error == nil { - t.Fatalf("expect error") - } - if e, a := "InvalidParameter", req.Error.(awserr.Error).Code(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "3 validation error(s) found.", req.Error.(awserr.Error).Message(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - errs := req.Error.(awserr.BatchedErrors).OrigErrs() - if e, a := 3, len(errs); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "ParamRequiredError: missing required field, StructShape.RequiredList[0].Name.", errs[0].Error(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "ParamRequiredError: missing required field, StructShape.RequiredMap[key2].Name.", errs[1].Error(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "ParamRequiredError: missing required field, StructShape.OptionalStruct.Name.", errs[2].Error(); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -type testInput struct { - StringField *string `min:"5"` - ListField []string `min:"3"` - MapField map[string]string `min:"4"` -} - -func (s testInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "testInput"} - if s.StringField != nil && len(*s.StringField) < 5 { - invalidParams.Add(request.NewErrParamMinLen("StringField", 5)) - } - if s.ListField != nil && len(s.ListField) < 3 { - invalidParams.Add(request.NewErrParamMinLen("ListField", 3)) - } - if s.MapField != nil && len(s.MapField) < 4 { - invalidParams.Add(request.NewErrParamMinLen("MapField", 4)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -var testsFieldMin = []struct { - err awserr.Error - in testInput -}{ - { - err: func() awserr.Error { - invalidParams := request.ErrInvalidParams{Context: "testInput"} - invalidParams.Add(request.NewErrParamMinLen("StringField", 5)) - return invalidParams - }(), - in: testInput{StringField: aws.String("abcd")}, - }, - { - err: func() awserr.Error { - invalidParams := request.ErrInvalidParams{Context: "testInput"} - invalidParams.Add(request.NewErrParamMinLen("StringField", 5)) - invalidParams.Add(request.NewErrParamMinLen("ListField", 3)) - return invalidParams - }(), - in: testInput{StringField: aws.String("abcd"), ListField: []string{"a", "b"}}, - }, - { - err: func() awserr.Error { - invalidParams := request.ErrInvalidParams{Context: "testInput"} - invalidParams.Add(request.NewErrParamMinLen("StringField", 5)) - invalidParams.Add(request.NewErrParamMinLen("ListField", 3)) - invalidParams.Add(request.NewErrParamMinLen("MapField", 4)) - return invalidParams - }(), - in: testInput{StringField: aws.String("abcd"), ListField: []string{"a", "b"}, MapField: map[string]string{"a": "a", "b": "b"}}, - }, - { - err: nil, - in: testInput{StringField: aws.String("abcde"), - ListField: []string{"a", "b", "c"}, MapField: map[string]string{"a": "a", "b": "b", "c": "c", "d": "d"}}, - }, -} - -func TestValidateFieldMinParameter(t *testing.T) { - for i, c := range testsFieldMin { - req := testSvc.NewRequest(&request.Operation{}, &c.in, nil) - corehandlers.ValidateParametersHandler.Fn(req) - - if e, a := c.err, req.Error; !reflect.DeepEqual(e,a) { - t.Errorf("%d, expect %v, got %v", i, e, a) - } - } -} - -func BenchmarkValidateAny(b *testing.B) { - input := &kinesis.PutRecordsInput{ - StreamName: aws.String("stream"), - } - for i := 0; i < 100; i++ { - record := &kinesis.PutRecordsRequestEntry{ - Data: make([]byte, 10000), - PartitionKey: aws.String("partition"), - } - input.Records = append(input.Records, record) - } - - req, _ := kinesis.New(unit.Session).PutRecordsRequest(input) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - corehandlers.ValidateParametersHandler.Fn(req) - if err := req.Error; err != nil { - b.Fatalf("validation failed: %v", err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go deleted file mode 100644 index f298d659..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go +++ /dev/null @@ -1,102 +0,0 @@ -package credentials - -import ( - "github.com/aws/aws-sdk-go/aws/awserr" -) - -var ( - // ErrNoValidProvidersFoundInChain Is returned when there are no valid - // providers in the ChainProvider. - // - // This has been deprecated. For verbose error messaging set - // aws.Config.CredentialsChainVerboseErrors to true - // - // @readonly - ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", - `no valid providers in chain. Deprecated. - For verbose messaging see aws.Config.CredentialsChainVerboseErrors`, - nil) -) - -// A ChainProvider will search for a provider which returns credentials -// and cache that provider until Retrieve is called again. -// -// The ChainProvider provides a way of chaining multiple providers together -// which will pick the first available using priority order of the Providers -// in the list. -// -// If none of the Providers retrieve valid credentials Value, ChainProvider's -// Retrieve() will return the error ErrNoValidProvidersFoundInChain. -// -// If a Provider is found which returns valid credentials Value ChainProvider -// will cache that Provider for all calls to IsExpired(), until Retrieve is -// called again. -// -// Example of ChainProvider to be used with an EnvProvider and EC2RoleProvider. -// In this example EnvProvider will first check if any credentials are available -// via the environment variables. If there are none ChainProvider will check -// the next Provider in the list, EC2RoleProvider in this case. If EC2RoleProvider -// does not return any credentials ChainProvider will return the error -// ErrNoValidProvidersFoundInChain -// -// creds := credentials.NewChainCredentials( -// []credentials.Provider{ -// &credentials.EnvProvider{}, -// &ec2rolecreds.EC2RoleProvider{ -// Client: ec2metadata.New(sess), -// }, -// }) -// -// // Usage of ChainCredentials with aws.Config -// svc := ec2.New(session.Must(session.NewSession(&aws.Config{ -// Credentials: creds, -// }))) -// -type ChainProvider struct { - Providers []Provider - curr Provider - VerboseErrors bool -} - -// NewChainCredentials returns a pointer to a new Credentials object -// wrapping a chain of providers. -func NewChainCredentials(providers []Provider) *Credentials { - return NewCredentials(&ChainProvider{ - Providers: append([]Provider{}, providers...), - }) -} - -// Retrieve returns the credentials value or error if no provider returned -// without error. -// -// If a provider is found it will be cached and any calls to IsExpired() -// will return the expired state of the cached provider. -func (c *ChainProvider) Retrieve() (Value, error) { - var errs []error - for _, p := range c.Providers { - creds, err := p.Retrieve() - if err == nil { - c.curr = p - return creds, nil - } - errs = append(errs, err) - } - c.curr = nil - - var err error - err = ErrNoValidProvidersFoundInChain - if c.VerboseErrors { - err = awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs) - } - return Value{}, err -} - -// IsExpired will returned the expired state of the currently cached provider -// if there is one. If there is no current provider, true will be returned. -func (c *ChainProvider) IsExpired() bool { - if c.curr != nil { - return c.curr.IsExpired() - } - - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go deleted file mode 100644 index 3b393a2e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go +++ /dev/null @@ -1,154 +0,0 @@ -package credentials - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/stretchr/testify/assert" -) - -type secondStubProvider struct { - creds Value - expired bool - err error -} - -func (s *secondStubProvider) Retrieve() (Value, error) { - s.expired = false - s.creds.ProviderName = "secondStubProvider" - return s.creds, s.err -} -func (s *secondStubProvider) IsExpired() bool { - return s.expired -} - -func TestChainProviderWithNames(t *testing.T) { - p := &ChainProvider{ - Providers: []Provider{ - &stubProvider{err: awserr.New("FirstError", "first provider error", nil)}, - &stubProvider{err: awserr.New("SecondError", "second provider error", nil)}, - &secondStubProvider{ - creds: Value{ - AccessKeyID: "AKIF", - SecretAccessKey: "NOSECRET", - SessionToken: "", - }, - }, - &stubProvider{ - creds: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - }, - }, - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.Equal(t, "secondStubProvider", creds.ProviderName, "Expect provider name to match") - - // Also check credentials - assert.Equal(t, "AKIF", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "NOSECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect session token to be empty") - -} - -func TestChainProviderGet(t *testing.T) { - p := &ChainProvider{ - Providers: []Provider{ - &stubProvider{err: awserr.New("FirstError", "first provider error", nil)}, - &stubProvider{err: awserr.New("SecondError", "second provider error", nil)}, - &stubProvider{ - creds: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - }, - }, - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect session token to be empty") -} - -func TestChainProviderIsExpired(t *testing.T) { - stubProvider := &stubProvider{expired: true} - p := &ChainProvider{ - Providers: []Provider{ - stubProvider, - }, - } - - assert.True(t, p.IsExpired(), "Expect expired to be true before any Retrieve") - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.False(t, p.IsExpired(), "Expect not expired after retrieve") - - stubProvider.expired = true - assert.True(t, p.IsExpired(), "Expect return of expired provider") - - _, err = p.Retrieve() - assert.False(t, p.IsExpired(), "Expect not expired after retrieve") -} - -func TestChainProviderWithNoProvider(t *testing.T) { - p := &ChainProvider{ - Providers: []Provider{}, - } - - assert.True(t, p.IsExpired(), "Expect expired with no providers") - _, err := p.Retrieve() - assert.Equal(t, - ErrNoValidProvidersFoundInChain, - err, - "Expect no providers error returned") -} - -func TestChainProviderWithNoValidProvider(t *testing.T) { - errs := []error{ - awserr.New("FirstError", "first provider error", nil), - awserr.New("SecondError", "second provider error", nil), - } - p := &ChainProvider{ - Providers: []Provider{ - &stubProvider{err: errs[0]}, - &stubProvider{err: errs[1]}, - }, - } - - assert.True(t, p.IsExpired(), "Expect expired with no providers") - _, err := p.Retrieve() - - assert.Equal(t, - ErrNoValidProvidersFoundInChain, - err, - "Expect no providers error returned") -} - -func TestChainProviderWithNoValidProviderWithVerboseEnabled(t *testing.T) { - errs := []error{ - awserr.New("FirstError", "first provider error", nil), - awserr.New("SecondError", "second provider error", nil), - } - p := &ChainProvider{ - VerboseErrors: true, - Providers: []Provider{ - &stubProvider{err: errs[0]}, - &stubProvider{err: errs[1]}, - }, - } - - assert.True(t, p.IsExpired(), "Expect expired with no providers") - _, err := p.Retrieve() - - assert.Equal(t, - awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs), - err, - "Expect no providers error returned") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go deleted file mode 100644 index 42416fc2..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ /dev/null @@ -1,246 +0,0 @@ -// Package credentials provides credential retrieval and management -// -// The Credentials is the primary method of getting access to and managing -// credentials Values. Using dependency injection retrieval of the credential -// values is handled by a object which satisfies the Provider interface. -// -// By default the Credentials.Get() will cache the successful result of a -// Provider's Retrieve() until Provider.IsExpired() returns true. At which -// point Credentials will call Provider's Retrieve() to get new credential Value. -// -// The Provider is responsible for determining when credentials Value have expired. -// It is also important to note that Credentials will always call Retrieve the -// first time Credentials.Get() is called. -// -// Example of using the environment variable credentials. -// -// creds := credentials.NewEnvCredentials() -// -// // Retrieve the credentials value -// credValue, err := creds.Get() -// if err != nil { -// // handle error -// } -// -// Example of forcing credentials to expire and be refreshed on the next Get(). -// This may be helpful to proactively expire credentials and refresh them sooner -// than they would naturally expire on their own. -// -// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{}) -// creds.Expire() -// credsValue, err := creds.Get() -// // New credentials will be retrieved instead of from cache. -// -// -// Custom Provider -// -// Each Provider built into this package also provides a helper method to generate -// a Credentials pointer setup with the provider. To use a custom Provider just -// create a type which satisfies the Provider interface and pass it to the -// NewCredentials method. -// -// type MyProvider struct{} -// func (m *MyProvider) Retrieve() (Value, error) {...} -// func (m *MyProvider) IsExpired() bool {...} -// -// creds := credentials.NewCredentials(&MyProvider{}) -// credValue, err := creds.Get() -// -package credentials - -import ( - "sync" - "time" -) - -// AnonymousCredentials is an empty Credential object that can be used as -// dummy placeholder credentials for requests that do not need signed. -// -// This Credentials can be used to configure a service to not sign requests -// when making service API calls. For example, when accessing public -// s3 buckets. -// -// svc := s3.New(session.Must(session.NewSession(&aws.Config{ -// Credentials: credentials.AnonymousCredentials, -// }))) -// // Access public S3 buckets. -// -// @readonly -var AnonymousCredentials = NewStaticCredentials("", "", "") - -// A Value is the AWS credentials value for individual credential fields. -type Value struct { - // AWS Access key ID - AccessKeyID string - - // AWS Secret Access Key - SecretAccessKey string - - // AWS Session Token - SessionToken string - - // Provider used to get credentials - ProviderName string -} - -// A Provider is the interface for any component which will provide credentials -// Value. A provider is required to manage its own Expired state, and what to -// be expired means. -// -// The Provider should not need to implement its own mutexes, because -// that will be managed by Credentials. -type Provider interface { - // Retrieve returns nil if it successfully retrieved the value. - // Error is returned if the value were not obtainable, or empty. - Retrieve() (Value, error) - - // IsExpired returns if the credentials are no longer valid, and need - // to be retrieved. - IsExpired() bool -} - -// An ErrorProvider is a stub credentials provider that always returns an error -// this is used by the SDK when construction a known provider is not possible -// due to an error. -type ErrorProvider struct { - // The error to be returned from Retrieve - Err error - - // The provider name to set on the Retrieved returned Value - ProviderName string -} - -// Retrieve will always return the error that the ErrorProvider was created with. -func (p ErrorProvider) Retrieve() (Value, error) { - return Value{ProviderName: p.ProviderName}, p.Err -} - -// IsExpired will always return not expired. -func (p ErrorProvider) IsExpired() bool { - return false -} - -// A Expiry provides shared expiration logic to be used by credentials -// providers to implement expiry functionality. -// -// The best method to use this struct is as an anonymous field within the -// provider's struct. -// -// Example: -// type EC2RoleProvider struct { -// Expiry -// ... -// } -type Expiry struct { - // The date/time when to expire on - expiration time.Time - - // If set will be used by IsExpired to determine the current time. - // Defaults to time.Now if CurrentTime is not set. Available for testing - // to be able to mock out the current time. - CurrentTime func() time.Time -} - -// SetExpiration sets the expiration IsExpired will check when called. -// -// If window is greater than 0 the expiration time will be reduced by the -// window value. -// -// Using a window is helpful to trigger credentials to expire sooner than -// the expiration time given to ensure no requests are made with expired -// tokens. -func (e *Expiry) SetExpiration(expiration time.Time, window time.Duration) { - e.expiration = expiration - if window > 0 { - e.expiration = e.expiration.Add(-window) - } -} - -// IsExpired returns if the credentials are expired. -func (e *Expiry) IsExpired() bool { - if e.CurrentTime == nil { - e.CurrentTime = time.Now - } - return e.expiration.Before(e.CurrentTime()) -} - -// A Credentials provides synchronous safe retrieval of AWS credentials Value. -// Credentials will cache the credentials value until they expire. Once the value -// expires the next Get will attempt to retrieve valid credentials. -// -// Credentials is safe to use across multiple goroutines and will manage the -// synchronous state so the Providers do not need to implement their own -// synchronization. -// -// The first Credentials.Get() will always call Provider.Retrieve() to get the -// first instance of the credentials Value. All calls to Get() after that -// will return the cached credentials Value until IsExpired() returns true. -type Credentials struct { - creds Value - forceRefresh bool - m sync.Mutex - - provider Provider -} - -// NewCredentials returns a pointer to a new Credentials with the provider set. -func NewCredentials(provider Provider) *Credentials { - return &Credentials{ - provider: provider, - forceRefresh: true, - } -} - -// Get returns the credentials value, or error if the credentials Value failed -// to be retrieved. -// -// Will return the cached credentials Value if it has not expired. If the -// credentials Value has expired the Provider's Retrieve() will be called -// to refresh the credentials. -// -// If Credentials.Expire() was called the credentials Value will be force -// expired, and the next call to Get() will cause them to be refreshed. -func (c *Credentials) Get() (Value, error) { - c.m.Lock() - defer c.m.Unlock() - - if c.isExpired() { - creds, err := c.provider.Retrieve() - if err != nil { - return Value{}, err - } - c.creds = creds - c.forceRefresh = false - } - - return c.creds, nil -} - -// Expire expires the credentials and forces them to be retrieved on the -// next call to Get(). -// -// This will override the Provider's expired state, and force Credentials -// to call the Provider's Retrieve(). -func (c *Credentials) Expire() { - c.m.Lock() - defer c.m.Unlock() - - c.forceRefresh = true -} - -// IsExpired returns if the credentials are no longer valid, and need -// to be retrieved. -// -// If the Credentials were forced to be expired with Expire() this will -// reflect that override. -func (c *Credentials) IsExpired() bool { - c.m.Lock() - defer c.m.Unlock() - - return c.isExpired() -} - -// isExpired helper method wrapping the definition of expired credentials. -func (c *Credentials) isExpired() bool { - return c.forceRefresh || c.provider.IsExpired() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go deleted file mode 100644 index 7b79ba98..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package credentials - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/stretchr/testify/assert" -) - -type stubProvider struct { - creds Value - expired bool - err error -} - -func (s *stubProvider) Retrieve() (Value, error) { - s.expired = false - s.creds.ProviderName = "stubProvider" - return s.creds, s.err -} -func (s *stubProvider) IsExpired() bool { - return s.expired -} - -func TestCredentialsGet(t *testing.T) { - c := NewCredentials(&stubProvider{ - creds: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - expired: true, - }) - - creds, err := c.Get() - assert.Nil(t, err, "Expected no error") - assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect session token to be empty") -} - -func TestCredentialsGetWithError(t *testing.T) { - c := NewCredentials(&stubProvider{err: awserr.New("provider error", "", nil), expired: true}) - - _, err := c.Get() - assert.Equal(t, "provider error", err.(awserr.Error).Code(), "Expected provider error") -} - -func TestCredentialsExpire(t *testing.T) { - stub := &stubProvider{} - c := NewCredentials(stub) - - stub.expired = false - assert.True(t, c.IsExpired(), "Expected to start out expired") - c.Expire() - assert.True(t, c.IsExpired(), "Expected to be expired") - - c.forceRefresh = false - assert.False(t, c.IsExpired(), "Expected not to be expired") - - stub.expired = true - assert.True(t, c.IsExpired(), "Expected to be expired") -} - -func TestCredentialsGetWithProviderName(t *testing.T) { - stub := &stubProvider{} - - c := NewCredentials(stub) - - creds, err := c.Get() - assert.Nil(t, err, "Expected no error") - assert.Equal(t, creds.ProviderName, "stubProvider", "Expected provider name to match") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go deleted file mode 100644 index c3974952..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go +++ /dev/null @@ -1,178 +0,0 @@ -package ec2rolecreds - -import ( - "bufio" - "encoding/json" - "fmt" - "path" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/ec2metadata" -) - -// ProviderName provides a name of EC2Role provider -const ProviderName = "EC2RoleProvider" - -// A EC2RoleProvider retrieves credentials from the EC2 service, and keeps track if -// those credentials are expired. -// -// Example how to configure the EC2RoleProvider with custom http Client, Endpoint -// or ExpiryWindow -// -// p := &ec2rolecreds.EC2RoleProvider{ -// // Pass in a custom timeout to be used when requesting -// // IAM EC2 Role credentials. -// Client: ec2metadata.New(sess, aws.Config{ -// HTTPClient: &http.Client{Timeout: 10 * time.Second}, -// }), -// -// // Do not use early expiry of credentials. If a non zero value is -// // specified the credentials will be expired early -// ExpiryWindow: 0, -// } -type EC2RoleProvider struct { - credentials.Expiry - - // Required EC2Metadata client to use when connecting to EC2 metadata service. - Client *ec2metadata.EC2Metadata - - // ExpiryWindow will allow the credentials to trigger refreshing prior to - // the credentials actually expiring. This is beneficial so race conditions - // with expiring credentials do not cause request to fail unexpectedly - // due to ExpiredTokenException exceptions. - // - // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true - // 10 seconds before the credentials are actually expired. - // - // If ExpiryWindow is 0 or less it will be ignored. - ExpiryWindow time.Duration -} - -// NewCredentials returns a pointer to a new Credentials object wrapping -// the EC2RoleProvider. Takes a ConfigProvider to create a EC2Metadata client. -// The ConfigProvider is satisfied by the session.Session type. -func NewCredentials(c client.ConfigProvider, options ...func(*EC2RoleProvider)) *credentials.Credentials { - p := &EC2RoleProvider{ - Client: ec2metadata.New(c), - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// NewCredentialsWithClient returns a pointer to a new Credentials object wrapping -// the EC2RoleProvider. Takes a EC2Metadata client to use when connecting to EC2 -// metadata service. -func NewCredentialsWithClient(client *ec2metadata.EC2Metadata, options ...func(*EC2RoleProvider)) *credentials.Credentials { - p := &EC2RoleProvider{ - Client: client, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// Retrieve retrieves credentials from the EC2 service. -// Error will be returned if the request fails, or unable to extract -// the desired credentials. -func (m *EC2RoleProvider) Retrieve() (credentials.Value, error) { - credsList, err := requestCredList(m.Client) - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - - if len(credsList) == 0 { - return credentials.Value{ProviderName: ProviderName}, awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil) - } - credsName := credsList[0] - - roleCreds, err := requestCred(m.Client, credsName) - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - - m.SetExpiration(roleCreds.Expiration, m.ExpiryWindow) - - return credentials.Value{ - AccessKeyID: roleCreds.AccessKeyID, - SecretAccessKey: roleCreds.SecretAccessKey, - SessionToken: roleCreds.Token, - ProviderName: ProviderName, - }, nil -} - -// A ec2RoleCredRespBody provides the shape for unmarshaling credential -// request responses. -type ec2RoleCredRespBody struct { - // Success State - Expiration time.Time - AccessKeyID string - SecretAccessKey string - Token string - - // Error state - Code string - Message string -} - -const iamSecurityCredsPath = "/iam/security-credentials" - -// requestCredList requests a list of credentials from the EC2 service. -// If there are no credentials, or there is an error making or receiving the request -func requestCredList(client *ec2metadata.EC2Metadata) ([]string, error) { - resp, err := client.GetMetadata(iamSecurityCredsPath) - if err != nil { - return nil, awserr.New("EC2RoleRequestError", "no EC2 instance role found", err) - } - - credsList := []string{} - s := bufio.NewScanner(strings.NewReader(resp)) - for s.Scan() { - credsList = append(credsList, s.Text()) - } - - if err := s.Err(); err != nil { - return nil, awserr.New("SerializationError", "failed to read EC2 instance role from metadata service", err) - } - - return credsList, nil -} - -// requestCred requests the credentials for a specific credentials from the EC2 service. -// -// If the credentials cannot be found, or there is an error reading the response -// and error will be returned. -func requestCred(client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCredRespBody, error) { - resp, err := client.GetMetadata(path.Join(iamSecurityCredsPath, credsName)) - if err != nil { - return ec2RoleCredRespBody{}, - awserr.New("EC2RoleRequestError", - fmt.Sprintf("failed to get %s EC2 instance role credentials", credsName), - err) - } - - respCreds := ec2RoleCredRespBody{} - if err := json.NewDecoder(strings.NewReader(resp)).Decode(&respCreds); err != nil { - return ec2RoleCredRespBody{}, - awserr.New("SerializationError", - fmt.Sprintf("failed to decode %s EC2 instance role credentials", credsName), - err) - } - - if respCreds.Code != "Success" { - // If an error code was returned something failed requesting the role. - return ec2RoleCredRespBody{}, awserr.New(respCreds.Code, respCreds.Message, nil) - } - - return respCreds, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go deleted file mode 100644 index cccd4bff..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go +++ /dev/null @@ -1,159 +0,0 @@ -package ec2rolecreds_test - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/awstesting/unit" -) - -const credsRespTmpl = `{ - "Code": "Success", - "Type": "AWS-HMAC", - "AccessKeyId" : "accessKey", - "SecretAccessKey" : "secret", - "Token" : "token", - "Expiration" : "%s", - "LastUpdated" : "2009-11-23T0:00:00Z" -}` - -const credsFailRespTmpl = `{ - "Code": "ErrorCode", - "Message": "ErrorMsg", - "LastUpdated": "2009-11-23T0:00:00Z" -}` - -func initTestServer(expireOn string, failAssume bool) *httptest.Server { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/latest/meta-data/iam/security-credentials" { - fmt.Fprintln(w, "RoleName") - } else if r.URL.Path == "/latest/meta-data/iam/security-credentials/RoleName" { - if failAssume { - fmt.Fprintf(w, credsFailRespTmpl) - } else { - fmt.Fprintf(w, credsRespTmpl, expireOn) - } - } else { - http.Error(w, "bad request", http.StatusBadRequest) - } - })) - - return server -} - -func TestEC2RoleProvider(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error, %v", err) - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestEC2RoleProviderFailAssume(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", true) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - - creds, err := p.Retrieve() - assert.Error(t, err, "Expect error") - - e := err.(awserr.Error) - assert.Equal(t, "ErrorCode", e.Code()) - assert.Equal(t, "ErrorMsg", e.Message()) - assert.Nil(t, e.OrigErr()) - - assert.Equal(t, "", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "", creds.SessionToken, "Expect session token to match") -} - -func TestEC2RoleProviderIsExpired(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error, %v", err) - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") - - p.CurrentTime = func() time.Time { - return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired.") -} - -func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - ExpiryWindow: time.Hour * 1, - } - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error, %v", err) - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") - - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired.") -} - -func BenchmarkEC3RoleProvider(b *testing.B) { - server := initTestServer("2014-12-16T01:51:37Z", false) - defer server.Close() - - p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), - } - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - if _, err := p.Retrieve(); err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go deleted file mode 100644 index a4cec5c5..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go +++ /dev/null @@ -1,191 +0,0 @@ -// Package endpointcreds provides support for retrieving credentials from an -// arbitrary HTTP endpoint. -// -// The credentials endpoint Provider can receive both static and refreshable -// credentials that will expire. Credentials are static when an "Expiration" -// value is not provided in the endpoint's response. -// -// Static credentials will never expire once they have been retrieved. The format -// of the static credentials response: -// { -// "AccessKeyId" : "MUA...", -// "SecretAccessKey" : "/7PC5om....", -// } -// -// Refreshable credentials will expire within the "ExpiryWindow" of the Expiration -// value in the response. The format of the refreshable credentials response: -// { -// "AccessKeyId" : "MUA...", -// "SecretAccessKey" : "/7PC5om....", -// "Token" : "AQoDY....=", -// "Expiration" : "2016-02-25T06:03:31Z" -// } -// -// Errors should be returned in the following format and only returned with 400 -// or 500 HTTP status codes. -// { -// "code": "ErrorCode", -// "message": "Helpful error message." -// } -package endpointcreds - -import ( - "encoding/json" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" -) - -// ProviderName is the name of the credentials provider. -const ProviderName = `CredentialsEndpointProvider` - -// Provider satisfies the credentials.Provider interface, and is a client to -// retrieve credentials from an arbitrary endpoint. -type Provider struct { - staticCreds bool - credentials.Expiry - - // Requires a AWS Client to make HTTP requests to the endpoint with. - // the Endpoint the request will be made to is provided by the aws.Config's - // Endpoint value. - Client *client.Client - - // ExpiryWindow will allow the credentials to trigger refreshing prior to - // the credentials actually expiring. This is beneficial so race conditions - // with expiring credentials do not cause request to fail unexpectedly - // due to ExpiredTokenException exceptions. - // - // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true - // 10 seconds before the credentials are actually expired. - // - // If ExpiryWindow is 0 or less it will be ignored. - ExpiryWindow time.Duration -} - -// NewProviderClient returns a credentials Provider for retrieving AWS credentials -// from arbitrary endpoint. -func NewProviderClient(cfg aws.Config, handlers request.Handlers, endpoint string, options ...func(*Provider)) credentials.Provider { - p := &Provider{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "CredentialsEndpoint", - Endpoint: endpoint, - }, - handlers, - ), - } - - p.Client.Handlers.Unmarshal.PushBack(unmarshalHandler) - p.Client.Handlers.UnmarshalError.PushBack(unmarshalError) - p.Client.Handlers.Validate.Clear() - p.Client.Handlers.Validate.PushBack(validateEndpointHandler) - - for _, option := range options { - option(p) - } - - return p -} - -// NewCredentialsClient returns a Credentials wrapper for retrieving credentials -// from an arbitrary endpoint concurrently. The client will request the -func NewCredentialsClient(cfg aws.Config, handlers request.Handlers, endpoint string, options ...func(*Provider)) *credentials.Credentials { - return credentials.NewCredentials(NewProviderClient(cfg, handlers, endpoint, options...)) -} - -// IsExpired returns true if the credentials retrieved are expired, or not yet -// retrieved. -func (p *Provider) IsExpired() bool { - if p.staticCreds { - return false - } - return p.Expiry.IsExpired() -} - -// Retrieve will attempt to request the credentials from the endpoint the Provider -// was configured for. And error will be returned if the retrieval fails. -func (p *Provider) Retrieve() (credentials.Value, error) { - resp, err := p.getCredentials() - if err != nil { - return credentials.Value{ProviderName: ProviderName}, - awserr.New("CredentialsEndpointError", "failed to load credentials", err) - } - - if resp.Expiration != nil { - p.SetExpiration(*resp.Expiration, p.ExpiryWindow) - } else { - p.staticCreds = true - } - - return credentials.Value{ - AccessKeyID: resp.AccessKeyID, - SecretAccessKey: resp.SecretAccessKey, - SessionToken: resp.Token, - ProviderName: ProviderName, - }, nil -} - -type getCredentialsOutput struct { - Expiration *time.Time - AccessKeyID string - SecretAccessKey string - Token string -} - -type errorOutput struct { - Code string `json:"code"` - Message string `json:"message"` -} - -func (p *Provider) getCredentials() (*getCredentialsOutput, error) { - op := &request.Operation{ - Name: "GetCredentials", - HTTPMethod: "GET", - } - - out := &getCredentialsOutput{} - req := p.Client.NewRequest(op, nil, out) - req.HTTPRequest.Header.Set("Accept", "application/json") - - return out, req.Send() -} - -func validateEndpointHandler(r *request.Request) { - if len(r.ClientInfo.Endpoint) == 0 { - r.Error = aws.ErrMissingEndpoint - } -} - -func unmarshalHandler(r *request.Request) { - defer r.HTTPResponse.Body.Close() - - out := r.Data.(*getCredentialsOutput) - if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&out); err != nil { - r.Error = awserr.New("SerializationError", - "failed to decode endpoint credentials", - err, - ) - } -} - -func unmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - - var errOut errorOutput - if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&errOut); err != nil { - r.Error = awserr.New("SerializationError", - "failed to decode endpoint credentials", - err, - ) - } - - // Response body format is not consistent between metadata endpoints. - // Grab the error message as a string and include that as the source error - r.Error = awserr.New(errOut.Code, errOut.Message, nil) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider_test.go deleted file mode 100644 index ad057a35..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package endpointcreds_test - -import ( - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/stretchr/testify/assert" -) - -func TestRetrieveRefreshableCredentials(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, "/path/to/endpoint", r.URL.Path) - assert.Equal(t, "application/json", r.Header.Get("Accept")) - assert.Equal(t, "else", r.URL.Query().Get("something")) - - encoder := json.NewEncoder(w) - err := encoder.Encode(map[string]interface{}{ - "AccessKeyID": "AKID", - "SecretAccessKey": "SECRET", - "Token": "TOKEN", - "Expiration": time.Now().Add(1 * time.Hour), - }) - - if err != nil { - fmt.Println("failed to write out creds", err) - } - })) - - client := endpointcreds.NewProviderClient(*unit.Session.Config, - unit.Session.Handlers, - server.URL+"/path/to/endpoint?something=else", - ) - creds, err := client.Retrieve() - - assert.NoError(t, err) - - assert.Equal(t, "AKID", creds.AccessKeyID) - assert.Equal(t, "SECRET", creds.SecretAccessKey) - assert.Equal(t, "TOKEN", creds.SessionToken) - assert.False(t, client.IsExpired()) - - client.(*endpointcreds.Provider).CurrentTime = func() time.Time { - return time.Now().Add(2 * time.Hour) - } - - assert.True(t, client.IsExpired()) -} - -func TestRetrieveStaticCredentials(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - encoder := json.NewEncoder(w) - err := encoder.Encode(map[string]interface{}{ - "AccessKeyID": "AKID", - "SecretAccessKey": "SECRET", - }) - - if err != nil { - fmt.Println("failed to write out creds", err) - } - })) - - client := endpointcreds.NewProviderClient(*unit.Session.Config, unit.Session.Handlers, server.URL) - creds, err := client.Retrieve() - - assert.NoError(t, err) - - assert.Equal(t, "AKID", creds.AccessKeyID) - assert.Equal(t, "SECRET", creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) - assert.False(t, client.IsExpired()) -} - -func TestFailedRetrieveCredentials(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(400) - encoder := json.NewEncoder(w) - err := encoder.Encode(map[string]interface{}{ - "Code": "Error", - "Message": "Message", - }) - - if err != nil { - fmt.Println("failed to write error", err) - } - })) - - client := endpointcreds.NewProviderClient(*unit.Session.Config, unit.Session.Handlers, server.URL) - creds, err := client.Retrieve() - - assert.Error(t, err) - aerr := err.(awserr.Error) - - assert.Equal(t, "CredentialsEndpointError", aerr.Code()) - assert.Equal(t, "failed to load credentials", aerr.Message()) - - aerr = aerr.OrigErr().(awserr.Error) - assert.Equal(t, "Error", aerr.Code()) - assert.Equal(t, "Message", aerr.Message()) - - assert.Empty(t, creds.AccessKeyID) - assert.Empty(t, creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) - assert.True(t, client.IsExpired()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go deleted file mode 100644 index c14231a1..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go +++ /dev/null @@ -1,78 +0,0 @@ -package credentials - -import ( - "os" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// EnvProviderName provides a name of Env provider -const EnvProviderName = "EnvProvider" - -var ( - // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be - // found in the process's environment. - // - // @readonly - ErrAccessKeyIDNotFound = awserr.New("EnvAccessKeyNotFound", "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment", nil) - - // ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key - // can't be found in the process's environment. - // - // @readonly - ErrSecretAccessKeyNotFound = awserr.New("EnvSecretNotFound", "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment", nil) -) - -// A EnvProvider retrieves credentials from the environment variables of the -// running process. Environment credentials never expire. -// -// Environment variables used: -// -// * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY -// -// * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY -type EnvProvider struct { - retrieved bool -} - -// NewEnvCredentials returns a pointer to a new Credentials object -// wrapping the environment variable provider. -func NewEnvCredentials() *Credentials { - return NewCredentials(&EnvProvider{}) -} - -// Retrieve retrieves the keys from the environment. -func (e *EnvProvider) Retrieve() (Value, error) { - e.retrieved = false - - id := os.Getenv("AWS_ACCESS_KEY_ID") - if id == "" { - id = os.Getenv("AWS_ACCESS_KEY") - } - - secret := os.Getenv("AWS_SECRET_ACCESS_KEY") - if secret == "" { - secret = os.Getenv("AWS_SECRET_KEY") - } - - if id == "" { - return Value{ProviderName: EnvProviderName}, ErrAccessKeyIDNotFound - } - - if secret == "" { - return Value{ProviderName: EnvProviderName}, ErrSecretAccessKeyNotFound - } - - e.retrieved = true - return Value{ - AccessKeyID: id, - SecretAccessKey: secret, - SessionToken: os.Getenv("AWS_SESSION_TOKEN"), - ProviderName: EnvProviderName, - }, nil -} - -// IsExpired returns if the credentials have been retrieved. -func (e *EnvProvider) IsExpired() bool { - return !e.retrieved -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go deleted file mode 100644 index 53f6ce25..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package credentials - -import ( - "github.com/stretchr/testify/assert" - "os" - "testing" -) - -func TestEnvProviderRetrieve(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY_ID", "access") - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - os.Setenv("AWS_SESSION_TOKEN", "token") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "access", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestEnvProviderIsExpired(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY_ID", "access") - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - os.Setenv("AWS_SESSION_TOKEN", "token") - - e := EnvProvider{} - - assert.True(t, e.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := e.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.False(t, e.IsExpired(), "Expect creds to not be expired after retrieve.") -} - -func TestEnvProviderNoAccessKeyID(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_SECRET_ACCESS_KEY", "secret") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Equal(t, ErrAccessKeyIDNotFound, err, "ErrAccessKeyIDNotFound expected, but was %#v error: %#v", creds, err) -} - -func TestEnvProviderNoSecretAccessKey(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY_ID", "access") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Equal(t, ErrSecretAccessKeyNotFound, err, "ErrSecretAccessKeyNotFound expected, but was %#v error: %#v", creds, err) -} - -func TestEnvProviderAlternateNames(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_ACCESS_KEY", "access") - os.Setenv("AWS_SECRET_KEY", "secret") - - e := EnvProvider{} - creds, err := e.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "access", creds.AccessKeyID, "Expected access key ID") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expected secret access key") - assert.Empty(t, creds.SessionToken, "Expected no token") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini b/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini deleted file mode 100644 index 7fc91d9d..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini +++ /dev/null @@ -1,12 +0,0 @@ -[default] -aws_access_key_id = accessKey -aws_secret_access_key = secret -aws_session_token = token - -[no_token] -aws_access_key_id = accessKey -aws_secret_access_key = secret - -[with_colon] -aws_access_key_id: accessKey -aws_secret_access_key: secret diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go deleted file mode 100644 index 51e21e0f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go +++ /dev/null @@ -1,150 +0,0 @@ -package credentials - -import ( - "fmt" - "os" - - "github.com/go-ini/ini" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -// SharedCredsProviderName provides a name of SharedCreds provider -const SharedCredsProviderName = "SharedCredentialsProvider" - -var ( - // ErrSharedCredentialsHomeNotFound is emitted when the user directory cannot be found. - ErrSharedCredentialsHomeNotFound = awserr.New("UserHomeNotFound", "user home directory not found.", nil) -) - -// A SharedCredentialsProvider retrieves credentials from the current user's home -// directory, and keeps track if those credentials are expired. -// -// Profile ini file example: $HOME/.aws/credentials -type SharedCredentialsProvider struct { - // Path to the shared credentials file. - // - // If empty will look for "AWS_SHARED_CREDENTIALS_FILE" env variable. If the - // env value is empty will default to current user's home directory. - // Linux/OSX: "$HOME/.aws/credentials" - // Windows: "%USERPROFILE%\.aws\credentials" - Filename string - - // AWS Profile to extract credentials from the shared credentials file. If empty - // will default to environment variable "AWS_PROFILE" or "default" if - // environment variable is also not set. - Profile string - - // retrieved states if the credentials have been successfully retrieved. - retrieved bool -} - -// NewSharedCredentials returns a pointer to a new Credentials object -// wrapping the Profile file provider. -func NewSharedCredentials(filename, profile string) *Credentials { - return NewCredentials(&SharedCredentialsProvider{ - Filename: filename, - Profile: profile, - }) -} - -// Retrieve reads and extracts the shared credentials from the current -// users home directory. -func (p *SharedCredentialsProvider) Retrieve() (Value, error) { - p.retrieved = false - - filename, err := p.filename() - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, err - } - - creds, err := loadProfile(filename, p.profile()) - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, err - } - - p.retrieved = true - return creds, nil -} - -// IsExpired returns if the shared credentials have expired. -func (p *SharedCredentialsProvider) IsExpired() bool { - return !p.retrieved -} - -// loadProfiles loads from the file pointed to by shared credentials filename for profile. -// The credentials retrieved from the profile will be returned or error. Error will be -// returned if it fails to read from the file, or the data is invalid. -func loadProfile(filename, profile string) (Value, error) { - config, err := ini.Load(filename) - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to load shared credentials file", err) - } - iniProfile, err := config.GetSection(profile) - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to get profile", err) - } - - id, err := iniProfile.GetKey("aws_access_key_id") - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsAccessKey", - fmt.Sprintf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename), - err) - } - - secret, err := iniProfile.GetKey("aws_secret_access_key") - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsSecret", - fmt.Sprintf("shared credentials %s in %s did not contain aws_secret_access_key", profile, filename), - nil) - } - - // Default to empty string if not found - token := iniProfile.Key("aws_session_token") - - return Value{ - AccessKeyID: id.String(), - SecretAccessKey: secret.String(), - SessionToken: token.String(), - ProviderName: SharedCredsProviderName, - }, nil -} - -// filename returns the filename to use to read AWS shared credentials. -// -// Will return an error if the user's home directory path cannot be found. -func (p *SharedCredentialsProvider) filename() (string, error) { - if len(p.Filename) != 0 { - return p.Filename, nil - } - - if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); len(p.Filename) != 0 { - return p.Filename, nil - } - - if home := shareddefaults.UserHomeDir(); len(home) == 0 { - // Backwards compatibility of home directly not found error being returned. - // This error is too verbose, failure when opening the file would of been - // a better error to return. - return "", ErrSharedCredentialsHomeNotFound - } - - p.Filename = shareddefaults.SharedCredentialsFilename() - - return p.Filename, nil -} - -// profile returns the AWS shared credentials profile. If empty will read -// environment variable "AWS_PROFILE". If that is not set profile will -// return "default". -func (p *SharedCredentialsProvider) profile() string { - if p.Profile == "" { - p.Profile = os.Getenv("AWS_PROFILE") - } - if p.Profile == "" { - p.Profile = "default" - } - - return p.Profile -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go deleted file mode 100644 index 1eb45f26..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go +++ /dev/null @@ -1,136 +0,0 @@ -package credentials - -import ( - "os" - "path/filepath" - "testing" - - "github.com/aws/aws-sdk-go/internal/shareddefaults" - "github.com/stretchr/testify/assert" -) - -func TestSharedCredentialsProvider(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestSharedCredentialsProviderIsExpired(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve") -} - -func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILE(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "example.ini") - p := SharedCredentialsProvider{} - creds, err := p.Retrieve() - - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILEAbsPath(t *testing.T) { - os.Clearenv() - wd, err := os.Getwd() - assert.NoError(t, err) - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", filepath.Join(wd, "example.ini")) - p := SharedCredentialsProvider{} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestSharedCredentialsProviderWithAWS_PROFILE(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "no_token") - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no token") -} - -func TestSharedCredentialsProviderWithoutTokenFromProfile(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: "no_token"} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no token") -} - -func TestSharedCredentialsProviderColonInCredFile(t *testing.T) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: "with_colon"} - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no token") -} - -func TestSharedCredentialsProvider_DefaultFilename(t *testing.T) { - os.Clearenv() - os.Setenv("USERPROFILE", "profile_dir") - os.Setenv("HOME", "home_dir") - - // default filename and profile - p := SharedCredentialsProvider{} - - filename, err := p.filename() - - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if e, a := shareddefaults.SharedCredentialsFilename(), filename; e != a { - t.Errorf("expect %q filename, got %q", e, a) - } -} - -func BenchmarkSharedCredentialsProvider(b *testing.B) { - os.Clearenv() - - p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""} - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go deleted file mode 100644 index 4f5dab3f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go +++ /dev/null @@ -1,57 +0,0 @@ -package credentials - -import ( - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// StaticProviderName provides a name of Static provider -const StaticProviderName = "StaticProvider" - -var ( - // ErrStaticCredentialsEmpty is emitted when static credentials are empty. - // - // @readonly - ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) -) - -// A StaticProvider is a set of credentials which are set programmatically, -// and will never expire. -type StaticProvider struct { - Value -} - -// NewStaticCredentials returns a pointer to a new Credentials object -// wrapping a static credentials value provider. -func NewStaticCredentials(id, secret, token string) *Credentials { - return NewCredentials(&StaticProvider{Value: Value{ - AccessKeyID: id, - SecretAccessKey: secret, - SessionToken: token, - }}) -} - -// NewStaticCredentialsFromCreds returns a pointer to a new Credentials object -// wrapping the static credentials value provide. Same as NewStaticCredentials -// but takes the creds Value instead of individual fields -func NewStaticCredentialsFromCreds(creds Value) *Credentials { - return NewCredentials(&StaticProvider{Value: creds}) -} - -// Retrieve returns the credentials or error if the credentials are invalid. -func (s *StaticProvider) Retrieve() (Value, error) { - if s.AccessKeyID == "" || s.SecretAccessKey == "" { - return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty - } - - if len(s.Value.ProviderName) == 0 { - s.Value.ProviderName = StaticProviderName - } - return s.Value, nil -} - -// IsExpired returns if the credentials are expired. -// -// For StaticProvider, the credentials never expired. -func (s *StaticProvider) IsExpired() bool { - return false -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go deleted file mode 100644 index ea012369..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package credentials - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestStaticProviderGet(t *testing.T) { - s := StaticProvider{ - Value: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - } - - creds, err := s.Retrieve() - assert.Nil(t, err, "Expect no error") - assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match") - assert.Empty(t, creds.SessionToken, "Expect no session token") -} - -func TestStaticProviderIsExpired(t *testing.T) { - s := StaticProvider{ - Value: Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "", - }, - } - - assert.False(t, s.IsExpired(), "Expect static credentials to never expire") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go deleted file mode 100644 index 4108e433..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ /dev/null @@ -1,298 +0,0 @@ -/* -Package stscreds are credential Providers to retrieve STS AWS credentials. - -STS provides multiple ways to retrieve credentials which can be used when making -future AWS service API operation calls. - -The SDK will ensure that per instance of credentials.Credentials all requests -to refresh the credentials will be synchronized. But, the SDK is unable to -ensure synchronous usage of the AssumeRoleProvider if the value is shared -between multiple Credentials, Sessions or service clients. - -Assume Role - -To assume an IAM role using STS with the SDK you can create a new Credentials -with the SDKs's stscreds package. - - // Initial credentials loaded from SDK's default credential chain. Such as - // the environment, shared credentials (~/.aws/credentials), or EC2 Instance - // Role. These credentials will be used to to make the STS Assume Role API. - sess := session.Must(session.NewSession()) - - // Create the credentials from AssumeRoleProvider to assume the role - // referenced by the "myRoleARN" ARN. - creds := stscreds.NewCredentials(sess, "myRoleArn") - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess, &aws.Config{Credentials: creds}) - -Assume Role with static MFA Token - -To assume an IAM role with a MFA token you can either specify a MFA token code -directly or provide a function to prompt the user each time the credentials -need to refresh the role's credentials. Specifying the TokenCode should be used -for short lived operations that will not need to be refreshed, and when you do -not want to have direct control over the user provides their MFA token. - -With TokenCode the AssumeRoleProvider will be not be able to refresh the role's -credentials. - - // Create the credentials from AssumeRoleProvider to assume the role - // referenced by the "myRoleARN" ARN using the MFA token code provided. - creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { - p.SerialNumber = aws.String("myTokenSerialNumber") - p.TokenCode = aws.String("00000000") - }) - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess, &aws.Config{Credentials: creds}) - -Assume Role with MFA Token Provider - -To assume an IAM role with MFA for longer running tasks where the credentials -may need to be refreshed setting the TokenProvider field of AssumeRoleProvider -will allow the credential provider to prompt for new MFA token code when the -role's credentials need to be refreshed. - -The StdinTokenProvider function is available to prompt on stdin to retrieve -the MFA token code from the user. You can also implement custom prompts by -satisfing the TokenProvider function signature. - -Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will -have undesirable results as the StdinTokenProvider will not be synchronized. A -single Credentials with an AssumeRoleProvider can be shared safely. - - // Create the credentials from AssumeRoleProvider to assume the role - // referenced by the "myRoleARN" ARN. Prompting for MFA token from stdin. - creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { - p.SerialNumber = aws.String("myTokenSerialNumber") - p.TokenProvider = stscreds.StdinTokenProvider - }) - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess, &aws.Config{Credentials: creds}) - -*/ -package stscreds - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/service/sts" -) - -// StdinTokenProvider will prompt on stdout and read from stdin for a string value. -// An error is returned if reading from stdin fails. -// -// Use this function go read MFA tokens from stdin. The function makes no attempt -// to make atomic prompts from stdin across multiple gorouties. -// -// Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will -// have undesirable results as the StdinTokenProvider will not be synchronized. A -// single Credentials with an AssumeRoleProvider can be shared safely -// -// Will wait forever until something is provided on the stdin. -func StdinTokenProvider() (string, error) { - var v string - fmt.Printf("Assume Role MFA token code: ") - _, err := fmt.Scanln(&v) - - return v, err -} - -// ProviderName provides a name of AssumeRole provider -const ProviderName = "AssumeRoleProvider" - -// AssumeRoler represents the minimal subset of the STS client API used by this provider. -type AssumeRoler interface { - AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) -} - -// DefaultDuration is the default amount of time in minutes that the credentials -// will be valid for. -var DefaultDuration = time.Duration(15) * time.Minute - -// AssumeRoleProvider retrieves temporary credentials from the STS service, and -// keeps track of their expiration time. -// -// This credential provider will be used by the SDKs default credential change -// when shared configuration is enabled, and the shared config or shared credentials -// file configure assume role. See Session docs for how to do this. -// -// AssumeRoleProvider does not provide any synchronization and it is not safe -// to share this value across multiple Credentials, Sessions, or service clients -// without also sharing the same Credentials instance. -type AssumeRoleProvider struct { - credentials.Expiry - - // STS client to make assume role request with. - Client AssumeRoler - - // Role to be assumed. - RoleARN string - - // Session name, if you wish to reuse the credentials elsewhere. - RoleSessionName string - - // Expiry duration of the STS credentials. Defaults to 15 minutes if not set. - Duration time.Duration - - // Optional ExternalID to pass along, defaults to nil if not set. - ExternalID *string - - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. - Policy *string - - // The identification number of the MFA device that is associated with the user - // who is making the AssumeRole call. Specify this value if the trust policy - // of the role being assumed includes a condition that requires MFA authentication. - // The value is either the serial number for a hardware device (such as GAHT12345678) - // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). - SerialNumber *string - - // The value provided by the MFA device, if the trust policy of the role being - // assumed requires MFA (that is, if the policy includes a condition that tests - // for MFA). If the role being assumed requires MFA and if the TokenCode value - // is missing or expired, the AssumeRole call returns an "access denied" error. - // - // If SerialNumber is set and neither TokenCode nor TokenProvider are also - // set an error will be returned. - TokenCode *string - - // Async method of providing MFA token code for assuming an IAM role with MFA. - // The value returned by the function will be used as the TokenCode in the Retrieve - // call. See StdinTokenProvider for a provider that prompts and reads from stdin. - // - // This token provider will be called when ever the assumed role's - // credentials need to be refreshed when SerialNumber is also set and - // TokenCode is not set. - // - // If both TokenCode and TokenProvider is set, TokenProvider will be used and - // TokenCode is ignored. - TokenProvider func() (string, error) - - // ExpiryWindow will allow the credentials to trigger refreshing prior to - // the credentials actually expiring. This is beneficial so race conditions - // with expiring credentials do not cause request to fail unexpectedly - // due to ExpiredTokenException exceptions. - // - // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true - // 10 seconds before the credentials are actually expired. - // - // If ExpiryWindow is 0 or less it will be ignored. - ExpiryWindow time.Duration -} - -// NewCredentials returns a pointer to a new Credentials object wrapping the -// AssumeRoleProvider. The credentials will expire every 15 minutes and the -// role will be named after a nanosecond timestamp of this operation. -// -// Takes a Config provider to create the STS client. The ConfigProvider is -// satisfied by the session.Session type. -// -// It is safe to share the returned Credentials with multiple Sessions and -// service clients. All access to the credentials and refreshing them -// will be synchronized. -func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { - p := &AssumeRoleProvider{ - Client: sts.New(c), - RoleARN: roleARN, - Duration: DefaultDuration, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// NewCredentialsWithClient returns a pointer to a new Credentials object wrapping the -// AssumeRoleProvider. The credentials will expire every 15 minutes and the -// role will be named after a nanosecond timestamp of this operation. -// -// Takes an AssumeRoler which can be satisfied by the STS client. -// -// It is safe to share the returned Credentials with multiple Sessions and -// service clients. All access to the credentials and refreshing them -// will be synchronized. -func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { - p := &AssumeRoleProvider{ - Client: svc, - RoleARN: roleARN, - Duration: DefaultDuration, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// Retrieve generates a new set of temporary credentials using STS. -func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { - - // Apply defaults where parameters are not set. - if p.RoleSessionName == "" { - // Try to work out a role name that will hopefully end up unique. - p.RoleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano()) - } - if p.Duration == 0 { - // Expire as often as AWS permits. - p.Duration = DefaultDuration - } - input := &sts.AssumeRoleInput{ - DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), - RoleArn: aws.String(p.RoleARN), - RoleSessionName: aws.String(p.RoleSessionName), - ExternalId: p.ExternalID, - } - if p.Policy != nil { - input.Policy = p.Policy - } - if p.SerialNumber != nil { - if p.TokenCode != nil { - input.SerialNumber = p.SerialNumber - input.TokenCode = p.TokenCode - } else if p.TokenProvider != nil { - input.SerialNumber = p.SerialNumber - code, err := p.TokenProvider() - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - input.TokenCode = aws.String(code) - } else { - return credentials.Value{ProviderName: ProviderName}, - awserr.New("AssumeRoleTokenNotAvailable", - "assume role with MFA enabled, but neither TokenCode nor TokenProvider are set", nil) - } - } - - roleOutput, err := p.Client.AssumeRole(input) - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - - // We will proactively generate new credentials before they expire. - p.SetExpiration(*roleOutput.Credentials.Expiration, p.ExpiryWindow) - - return credentials.Value{ - AccessKeyID: *roleOutput.Credentials.AccessKeyId, - SecretAccessKey: *roleOutput.Credentials.SecretAccessKey, - SessionToken: *roleOutput.Credentials.SessionToken, - ProviderName: ProviderName, - }, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go deleted file mode 100644 index 4c0212a0..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package stscreds - -import ( - "fmt" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/stretchr/testify/assert" -) - -type stubSTS struct { - TestInput func(*sts.AssumeRoleInput) -} - -func (s *stubSTS) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) { - if s.TestInput != nil { - s.TestInput(input) - } - expiry := time.Now().Add(60 * time.Minute) - return &sts.AssumeRoleOutput{ - Credentials: &sts.Credentials{ - // Just reflect the role arn to the provider. - AccessKeyId: input.RoleArn, - SecretAccessKey: aws.String("assumedSecretAccessKey"), - SessionToken: aws.String("assumedSessionToken"), - Expiration: &expiry, - }, - }, nil -} - -func TestAssumeRoleProvider(t *testing.T) { - stub := &stubSTS{} - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN") - assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match") -} - -func TestAssumeRoleProvider_WithTokenCode(t *testing.T) { - stub := &stubSTS{ - TestInput: func(in *sts.AssumeRoleInput) { - assert.Equal(t, "0123456789", *in.SerialNumber) - assert.Equal(t, "code", *in.TokenCode) - }, - } - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - SerialNumber: aws.String("0123456789"), - TokenCode: aws.String("code"), - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN") - assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match") -} - -func TestAssumeRoleProvider_WithTokenProvider(t *testing.T) { - stub := &stubSTS{ - TestInput: func(in *sts.AssumeRoleInput) { - assert.Equal(t, "0123456789", *in.SerialNumber) - assert.Equal(t, "code", *in.TokenCode) - }, - } - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - SerialNumber: aws.String("0123456789"), - TokenProvider: func() (string, error) { - return "code", nil - }, - } - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN") - assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match") -} - -func TestAssumeRoleProvider_WithTokenProviderError(t *testing.T) { - stub := &stubSTS{ - TestInput: func(in *sts.AssumeRoleInput) { - assert.Fail(t, "API request should not of been called") - }, - } - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - SerialNumber: aws.String("0123456789"), - TokenProvider: func() (string, error) { - return "", fmt.Errorf("error occurred") - }, - } - - creds, err := p.Retrieve() - assert.Error(t, err) - - assert.Empty(t, creds.AccessKeyID) - assert.Empty(t, creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) -} - -func TestAssumeRoleProvider_MFAWithNoToken(t *testing.T) { - stub := &stubSTS{ - TestInput: func(in *sts.AssumeRoleInput) { - assert.Fail(t, "API request should not of been called") - }, - } - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - SerialNumber: aws.String("0123456789"), - } - - creds, err := p.Retrieve() - assert.Error(t, err) - - assert.Empty(t, creds.AccessKeyID) - assert.Empty(t, creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) -} - -func BenchmarkAssumeRoleProvider(b *testing.B) { - stub := &stubSTS{} - p := &AssumeRoleProvider{ - Client: stub, - RoleARN: "roleARN", - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - if _, err := p.Retrieve(); err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go deleted file mode 100644 index 07afe3b8..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ /dev/null @@ -1,163 +0,0 @@ -// Package defaults is a collection of helpers to retrieve the SDK's default -// configuration and handlers. -// -// Generally this package shouldn't be used directly, but session.Session -// instead. This package is useful when you need to reset the defaults -// of a session or service client to the SDK defaults before setting -// additional parameters. -package defaults - -import ( - "fmt" - "net/http" - "net/url" - "os" - "time" - - "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/credentials/ec2rolecreds" - "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/request" -) - -// A Defaults provides a collection of default values for SDK clients. -type Defaults struct { - Config *aws.Config - Handlers request.Handlers -} - -// Get returns the SDK's default values with Config and handlers pre-configured. -func Get() Defaults { - cfg := Config() - handlers := Handlers() - cfg.Credentials = CredChain(cfg, handlers) - - return Defaults{ - Config: cfg, - Handlers: handlers, - } -} - -// Config returns the default configuration without credentials. -// To retrieve a config with credentials also included use -// `defaults.Get().Config` instead. -// -// Generally you shouldn't need to use this method directly, but -// is available if you need to reset the configuration of an -// existing service client or session. -func Config() *aws.Config { - return aws.NewConfig(). - WithCredentials(credentials.AnonymousCredentials). - WithRegion(os.Getenv("AWS_REGION")). - WithHTTPClient(http.DefaultClient). - WithMaxRetries(aws.UseServiceDefaultRetries). - WithLogger(aws.NewDefaultLogger()). - WithLogLevel(aws.LogOff). - WithEndpointResolver(endpoints.DefaultResolver()) -} - -// Handlers returns the default request handlers. -// -// Generally you shouldn't need to use this method directly, but -// is available if you need to reset the request handlers of an -// existing service client or session. -func Handlers() request.Handlers { - var handlers request.Handlers - - handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) - handlers.Validate.AfterEachFn = request.HandlerListStopOnError - handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler) - handlers.Build.AfterEachFn = request.HandlerListStopOnError - handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) - handlers.Send.PushBackNamed(corehandlers.ValidateReqSigHandler) - handlers.Send.PushBackNamed(corehandlers.SendHandler) - handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) - handlers.ValidateResponse.PushBackNamed(corehandlers.ValidateResponseHandler) - - return handlers -} - -// CredChain returns the default credential chain. -// -// Generally you shouldn't need to use this method directly, but -// is available if you need to reset the credentials of an -// existing service client or session's Config. -func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credentials { - return credentials.NewCredentials(&credentials.ChainProvider{ - VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), - Providers: []credentials.Provider{ - &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, - RemoteCredProvider(*cfg, handlers), - }, - }) -} - -const ( - httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" - ecsCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" -) - -// RemoteCredProvider returns a credentials provider for the default remote -// endpoints such as EC2 or ECS Roles. -func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { - if u := os.Getenv(httpProviderEnvVar); len(u) > 0 { - return localHTTPCredProvider(cfg, handlers, u) - } - - if uri := os.Getenv(ecsCredsProviderEnvVar); len(uri) > 0 { - u := fmt.Sprintf("http://169.254.170.2%s", uri) - return httpCredProvider(cfg, handlers, u) - } - - return ec2RoleProvider(cfg, handlers) -} - -func localHTTPCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { - var errMsg string - - parsed, err := url.Parse(u) - if err != nil { - errMsg = fmt.Sprintf("invalid URL, %v", err) - } else if host := aws.URLHostname(parsed); !(host == "localhost" || host == "127.0.0.1") { - errMsg = fmt.Sprintf("invalid host address, %q, only localhost and 127.0.0.1 are valid.", host) - } - - if len(errMsg) > 0 { - if cfg.Logger != nil { - cfg.Logger.Log("Ignoring, HTTP credential provider", errMsg, err) - } - return credentials.ErrorProvider{ - Err: awserr.New("CredentialsEndpointError", errMsg, err), - ProviderName: endpointcreds.ProviderName, - } - } - - return httpCredProvider(cfg, handlers, u) -} - -func httpCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { - return endpointcreds.NewProviderClient(cfg, handlers, u, - func(p *endpointcreds.Provider) { - p.ExpiryWindow = 5 * time.Minute - }, - ) -} - -func ec2RoleProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { - resolver := cfg.EndpointResolver - if resolver == nil { - resolver = endpoints.DefaultResolver() - } - - e, _ := resolver.EndpointFor(endpoints.Ec2metadataServiceID, "") - return &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.NewClient(cfg, handlers, e.URL, e.SigningRegion), - ExpiryWindow: 5 * time.Minute, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go deleted file mode 100644 index d3e4a86b..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package defaults - -import ( - "fmt" - "os" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" - "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" - "github.com/aws/aws-sdk-go/aws/request" -) - -func TestHTTPCredProvider(t *testing.T) { - cases := []struct { - Host string - Fail bool - }{ - {"localhost", false}, {"127.0.0.1", false}, - {"www.example.com", true}, {"169.254.170.2", true}, - } - - defer os.Clearenv() - - for i, c := range cases { - u := fmt.Sprintf("http://%s/abc/123", c.Host) - os.Setenv(httpProviderEnvVar, u) - - provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) - if provider == nil { - t.Fatalf("%d, expect provider not to be nil, but was", i) - } - - if c.Fail { - creds, err := provider.Retrieve() - if err == nil { - t.Fatalf("%d, expect error but got none", i) - } else { - aerr := err.(awserr.Error) - if e, a := "CredentialsEndpointError", aerr.Code(); e != a { - t.Errorf("%d, expect %s error code, got %s", i, e, a) - } - } - if e, a := endpointcreds.ProviderName, creds.ProviderName; e != a { - t.Errorf("%d, expect %s provider name got %s", i, e, a) - } - } else { - httpProvider := provider.(*endpointcreds.Provider) - if e, a := u, httpProvider.Client.Endpoint; e != a { - t.Errorf("%d, expect %q endpoint, got %q", i, e, a) - } - } - } -} - -func TestECSCredProvider(t *testing.T) { - defer os.Clearenv() - os.Setenv(ecsCredsProviderEnvVar, "/abc/123") - - provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) - if provider == nil { - t.Fatalf("expect provider not to be nil, but was") - } - - httpProvider := provider.(*endpointcreds.Provider) - if httpProvider == nil { - t.Fatalf("expect provider not to be nil, but was") - } - if e, a := "http://169.254.170.2/abc/123", httpProvider.Client.Endpoint; e != a { - t.Errorf("expect %q endpoint, got %q", e, a) - } -} - -func TestDefaultEC2RoleProvider(t *testing.T) { - provider := RemoteCredProvider(aws.Config{}, request.Handlers{}) - if provider == nil { - t.Fatalf("expect provider not to be nil, but was") - } - - ec2Provider := provider.(*ec2rolecreds.EC2RoleProvider) - if ec2Provider == nil { - t.Fatalf("expect provider not to be nil, but was") - } - if e, a := "http://169.254.169.254/latest", ec2Provider.Client.Endpoint; e != a { - t.Errorf("expect %q endpoint, got %q", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go deleted file mode 100644 index ca0ee1dc..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go +++ /dev/null @@ -1,27 +0,0 @@ -package defaults - -import ( - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -// SharedCredentialsFilename returns the SDK's default file path -// for the shared credentials file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/credentials -// - Windows: %USERPROFILE%\.aws\credentials -func SharedCredentialsFilename() string { - return shareddefaults.SharedCredentialsFilename() -} - -// SharedConfigFilename returns the SDK's default file path for -// the shared config file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/config -// - Windows: %USERPROFILE%\.aws\config -func SharedConfigFilename() string { - return shareddefaults.SharedConfigFilename() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/doc.go deleted file mode 100644 index 4fcb6161..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/doc.go +++ /dev/null @@ -1,56 +0,0 @@ -// Package aws provides the core SDK's utilities and shared types. Use this package's -// utilities to simplify setting and reading API operations parameters. -// -// Value and Pointer Conversion Utilities -// -// This package includes a helper conversion utility for each scalar type the SDK's -// API use. These utilities make getting a pointer of the scalar, and dereferencing -// a pointer easier. -// -// Each conversion utility comes in two forms. Value to Pointer and Pointer to Value. -// The Pointer to value will safely dereference the pointer and return its value. -// If the pointer was nil, the scalar's zero value will be returned. -// -// The value to pointer functions will be named after the scalar type. So get a -// *string from a string value use the "String" function. This makes it easy to -// to get pointer of a literal string value, because getting the address of a -// literal requires assigning the value to a variable first. -// -// var strPtr *string -// -// // Without the SDK's conversion functions -// str := "my string" -// strPtr = &str -// -// // With the SDK's conversion functions -// strPtr = aws.String("my string") -// -// // Convert *string to string value -// str = aws.StringValue(strPtr) -// -// In addition to scalars the aws package also includes conversion utilities for -// map and slice for commonly types used in API parameters. The map and slice -// conversion functions use similar naming pattern as the scalar conversion -// functions. -// -// var strPtrs []*string -// var strs []string = []string{"Go", "Gophers", "Go"} -// -// // Convert []string to []*string -// strPtrs = aws.StringSlice(strs) -// -// // Convert []*string to []string -// strs = aws.StringValueSlice(strPtrs) -// -// SDK Default HTTP Client -// -// The SDK will use the http.DefaultClient if a HTTP client is not provided to -// the SDK's Session, or service client constructor. This means that if the -// http.DefaultClient is modified by other components of your application the -// modifications will be picked up by the SDK as well. -// -// In some cases this might be intended, but it is a better practice to create -// a custom HTTP Client to share explicitly through your application. You can -// configure the SDK to use the custom HTTP Client by setting the HTTPClient -// value of the SDK's Config type when creating a Session or service client. -package aws diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go deleted file mode 100644 index 984407a5..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ /dev/null @@ -1,162 +0,0 @@ -package ec2metadata - -import ( - "encoding/json" - "fmt" - "net/http" - "path" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// GetMetadata uses the path provided to request information from the EC2 -// instance metdata service. The content will be returned as a string, or -// error if the request failed. -func (c *EC2Metadata) GetMetadata(p string) (string, error) { - op := &request.Operation{ - Name: "GetMetadata", - HTTPMethod: "GET", - HTTPPath: path.Join("/", "meta-data", p), - } - - output := &metadataOutput{} - req := c.NewRequest(op, nil, output) - - return output.Content, req.Send() -} - -// GetUserData returns the userdata that was configured for the service. If -// there is no user-data setup for the EC2 instance a "NotFoundError" error -// code will be returned. -func (c *EC2Metadata) GetUserData() (string, error) { - op := &request.Operation{ - Name: "GetUserData", - HTTPMethod: "GET", - HTTPPath: path.Join("/", "user-data"), - } - - output := &metadataOutput{} - req := c.NewRequest(op, nil, output) - req.Handlers.UnmarshalError.PushBack(func(r *request.Request) { - if r.HTTPResponse.StatusCode == http.StatusNotFound { - r.Error = awserr.New("NotFoundError", "user-data not found", r.Error) - } - }) - - return output.Content, req.Send() -} - -// GetDynamicData uses the path provided to request information from the EC2 -// instance metadata service for dynamic data. The content will be returned -// as a string, or error if the request failed. -func (c *EC2Metadata) GetDynamicData(p string) (string, error) { - op := &request.Operation{ - Name: "GetDynamicData", - HTTPMethod: "GET", - HTTPPath: path.Join("/", "dynamic", p), - } - - output := &metadataOutput{} - req := c.NewRequest(op, nil, output) - - return output.Content, req.Send() -} - -// GetInstanceIdentityDocument retrieves an identity document describing an -// instance. Error is returned if the request fails or is unable to parse -// the response. -func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument, error) { - resp, err := c.GetDynamicData("instance-identity/document") - if err != nil { - return EC2InstanceIdentityDocument{}, - awserr.New("EC2MetadataRequestError", - "failed to get EC2 instance identity document", err) - } - - doc := EC2InstanceIdentityDocument{} - if err := json.NewDecoder(strings.NewReader(resp)).Decode(&doc); err != nil { - return EC2InstanceIdentityDocument{}, - awserr.New("SerializationError", - "failed to decode EC2 instance identity document", err) - } - - return doc, nil -} - -// IAMInfo retrieves IAM info from the metadata API -func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { - resp, err := c.GetMetadata("iam/info") - if err != nil { - return EC2IAMInfo{}, - awserr.New("EC2MetadataRequestError", - "failed to get EC2 IAM info", err) - } - - info := EC2IAMInfo{} - if err := json.NewDecoder(strings.NewReader(resp)).Decode(&info); err != nil { - return EC2IAMInfo{}, - awserr.New("SerializationError", - "failed to decode EC2 IAM info", err) - } - - if info.Code != "Success" { - errMsg := fmt.Sprintf("failed to get EC2 IAM Info (%s)", info.Code) - return EC2IAMInfo{}, - awserr.New("EC2MetadataError", errMsg, nil) - } - - return info, nil -} - -// Region returns the region the instance is running in. -func (c *EC2Metadata) Region() (string, error) { - resp, err := c.GetMetadata("placement/availability-zone") - if err != nil { - return "", err - } - - // returns region without the suffix. Eg: us-west-2a becomes us-west-2 - return resp[:len(resp)-1], nil -} - -// Available returns if the application has access to the EC2 Metadata service. -// Can be used to determine if application is running within an EC2 Instance and -// the metadata service is available. -func (c *EC2Metadata) Available() bool { - if _, err := c.GetMetadata("instance-id"); err != nil { - return false - } - - return true -} - -// An EC2IAMInfo provides the shape for unmarshaling -// an IAM info from the metadata API -type EC2IAMInfo struct { - Code string - LastUpdated time.Time - InstanceProfileArn string - InstanceProfileID string -} - -// An EC2InstanceIdentityDocument provides the shape for unmarshaling -// an instance identity document -type EC2InstanceIdentityDocument struct { - DevpayProductCodes []string `json:"devpayProductCodes"` - AvailabilityZone string `json:"availabilityZone"` - PrivateIP string `json:"privateIp"` - Version string `json:"version"` - Region string `json:"region"` - InstanceID string `json:"instanceId"` - BillingProducts []string `json:"billingProducts"` - InstanceType string `json:"instanceType"` - AccountID string `json:"accountId"` - PendingTime time.Time `json:"pendingTime"` - ImageID string `json:"imageId"` - KernelID string `json:"kernelId"` - RamdiskID string `json:"ramdiskId"` - Architecture string `json:"architecture"` -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go deleted file mode 100644 index 7dde1fb3..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go +++ /dev/null @@ -1,289 +0,0 @@ -package ec2metadata_test - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/http/httptest" - "path" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" -) - -const instanceIdentityDocument = `{ - "devpayProductCodes" : null, - "availabilityZone" : "us-east-1d", - "privateIp" : "10.158.112.84", - "version" : "2010-08-31", - "region" : "us-east-1", - "instanceId" : "i-1234567890abcdef0", - "billingProducts" : null, - "instanceType" : "t1.micro", - "accountId" : "123456789012", - "pendingTime" : "2015-11-19T16:32:11Z", - "imageId" : "ami-5fb8c835", - "kernelId" : "aki-919dcaf8", - "ramdiskId" : null, - "architecture" : "x86_64" -}` - -const validIamInfo = `{ - "Code" : "Success", - "LastUpdated" : "2016-03-17T12:27:32Z", - "InstanceProfileArn" : "arn:aws:iam::123456789012:instance-profile/my-instance-profile", - "InstanceProfileId" : "AIPAABCDEFGHIJKLMN123" -}` - -const unsuccessfulIamInfo = `{ - "Code" : "Failed", - "LastUpdated" : "2016-03-17T12:27:32Z", - "InstanceProfileArn" : "arn:aws:iam::123456789012:instance-profile/my-instance-profile", - "InstanceProfileId" : "AIPAABCDEFGHIJKLMN123" -}` - -func initTestServer(path string, resp string) *httptest.Server { - return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI != path { - http.Error(w, "not found", http.StatusNotFound) - return - } - - w.Write([]byte(resp)) - })) -} - -func TestEndpoint(t *testing.T) { - c := ec2metadata.New(unit.Session) - op := &request.Operation{ - Name: "GetMetadata", - HTTPMethod: "GET", - HTTPPath: path.Join("/", "meta-data", "testpath"), - } - - req := c.NewRequest(op, nil, nil) - if e, a := "http://169.254.169.254/latest", req.ClientInfo.Endpoint; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "http://169.254.169.254/latest/meta-data/testpath", req.HTTPRequest.URL.String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestGetMetadata(t *testing.T) { - server := initTestServer( - "/latest/meta-data/some/path", - "success", // real response includes suffix - ) - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - resp, err := c.GetMetadata("some/path") - - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := "success", resp; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestGetUserData(t *testing.T) { - server := initTestServer( - "/latest/user-data", - "success", // real response includes suffix - ) - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - resp, err := c.GetUserData() - - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := "success", resp; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestGetUserData_Error(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - reader := strings.NewReader(` - - - - 404 - Not Found - - -

404 - Not Found

- -`) - w.Header().Set("Content-Type", "text/html") - w.Header().Set("Content-Length", fmt.Sprintf("%d", reader.Len())) - w.WriteHeader(http.StatusNotFound) - io.Copy(w, reader) - })) - - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - resp, err := c.GetUserData() - if err == nil { - t.Errorf("expect error") - } - if len(resp) != 0 { - t.Errorf("expect empty, got %v", resp) - } - - aerr := err.(awserr.Error) - if e, a := "NotFoundError", aerr.Code(); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestGetRegion(t *testing.T) { - server := initTestServer( - "/latest/meta-data/placement/availability-zone", - "us-west-2a", // real response includes suffix - ) - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - region, err := c.Region() - - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := "us-west-2", region; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestMetadataAvailable(t *testing.T) { - server := initTestServer( - "/latest/meta-data/instance-id", - "instance-id", - ) - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - if !c.Available() { - t.Errorf("expect available") - } -} - -func TestMetadataIAMInfo_success(t *testing.T) { - server := initTestServer( - "/latest/meta-data/iam/info", - validIamInfo, - ) - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - iamInfo, err := c.IAMInfo() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := "Success", iamInfo.Code; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "arn:aws:iam::123456789012:instance-profile/my-instance-profile", iamInfo.InstanceProfileArn; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "AIPAABCDEFGHIJKLMN123", iamInfo.InstanceProfileID; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestMetadataIAMInfo_failure(t *testing.T) { - server := initTestServer( - "/latest/meta-data/iam/info", - unsuccessfulIamInfo, - ) - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - iamInfo, err := c.IAMInfo() - if err == nil { - t.Errorf("expect error") - } - if e, a := "", iamInfo.Code; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "", iamInfo.InstanceProfileArn; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "", iamInfo.InstanceProfileID; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestMetadataNotAvailable(t *testing.T) { - c := ec2metadata.New(unit.Session) - c.Handlers.Send.Clear() - c.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: int(0), - Status: http.StatusText(int(0)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - r.Error = awserr.New("RequestError", "send request failed", nil) - r.Retryable = aws.Bool(true) // network errors are retryable - }) - - if c.Available() { - t.Errorf("expect not available") - } -} - -func TestMetadataErrorResponse(t *testing.T) { - c := ec2metadata.New(unit.Session) - c.Handlers.Send.Clear() - c.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: http.StatusBadRequest, - Status: http.StatusText(http.StatusBadRequest), - Body: ioutil.NopCloser(strings.NewReader("error message text")), - } - r.Retryable = aws.Bool(false) // network errors are retryable - }) - - data, err := c.GetMetadata("uri/path") - if len(data) != 0 { - t.Errorf("expect empty, got %v", data) - } - if e, a := "error message text", err.Error(); !strings.Contains(a, e) { - t.Errorf("expect %v to be in %v", e, a) - } -} - -func TestEC2RoleProviderInstanceIdentity(t *testing.T) { - server := initTestServer( - "/latest/dynamic/instance-identity/document", - instanceIdentityDocument, - ) - defer server.Close() - c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) - - doc, err := c.GetInstanceIdentityDocument() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := doc.AccountID, "123456789012"; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := doc.AvailabilityZone, "us-east-1d"; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := doc.Region, "us-east-1"; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go deleted file mode 100644 index 5b4379db..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ /dev/null @@ -1,124 +0,0 @@ -// Package ec2metadata provides the client for making API calls to the -// EC2 Metadata service. -package ec2metadata - -import ( - "bytes" - "errors" - "io" - "net/http" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" -) - -// ServiceName is the name of the service. -const ServiceName = "ec2metadata" - -// A EC2Metadata is an EC2 Metadata service Client. -type EC2Metadata struct { - *client.Client -} - -// New creates a new instance of the EC2Metadata client with a session. -// This client is safe to use across multiple goroutines. -// -// -// Example: -// // Create a EC2Metadata client from just a session. -// svc := ec2metadata.New(mySession) -// -// // Create a EC2Metadata client with additional configuration -// svc := ec2metadata.New(mySession, aws.NewConfig().WithLogLevel(aws.LogDebugHTTPBody)) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2Metadata { - c := p.ClientConfig(ServiceName, cfgs...) - return NewClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// NewClient returns a new EC2Metadata client. Should be used to create -// a client when not using a session. Generally using just New with a session -// is preferred. -// -// If an unmodified HTTP client is provided from the stdlib default, or no client -// the EC2RoleProvider's EC2Metadata HTTP client's timeout will be shortened. -// To disable this set Config.EC2MetadataDisableTimeoutOverride to false. Enabled by default. -func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string, opts ...func(*client.Client)) *EC2Metadata { - if !aws.BoolValue(cfg.EC2MetadataDisableTimeoutOverride) && httpClientZero(cfg.HTTPClient) { - // If the http client is unmodified and this feature is not disabled - // set custom timeouts for EC2Metadata requests. - cfg.HTTPClient = &http.Client{ - // use a shorter timeout than default because the metadata - // service is local if it is running, and to fail faster - // if not running on an ec2 instance. - Timeout: 5 * time.Second, - } - } - - svc := &EC2Metadata{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - Endpoint: endpoint, - APIVersion: "latest", - }, - handlers, - ), - } - - svc.Handlers.Unmarshal.PushBack(unmarshalHandler) - svc.Handlers.UnmarshalError.PushBack(unmarshalError) - svc.Handlers.Validate.Clear() - svc.Handlers.Validate.PushBack(validateEndpointHandler) - - // Add additional options to the service config - for _, option := range opts { - option(svc.Client) - } - - return svc -} - -func httpClientZero(c *http.Client) bool { - return c == nil || (c.Transport == nil && c.CheckRedirect == nil && c.Jar == nil && c.Timeout == 0) -} - -type metadataOutput struct { - Content string -} - -func unmarshalHandler(r *request.Request) { - defer r.HTTPResponse.Body.Close() - b := &bytes.Buffer{} - if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata respose", err) - return - } - - if data, ok := r.Data.(*metadataOutput); ok { - data.Content = b.String() - } -} - -func unmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - b := &bytes.Buffer{} - if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata error respose", err) - return - } - - // Response body format is not consistent between metadata endpoints. - // Grab the error message as a string and include that as the source error - r.Error = awserr.New("EC2MetadataError", "failed to make EC2Metadata request", errors.New(b.String())) -} - -func validateEndpointHandler(r *request.Request) { - if r.ClientInfo.Endpoint == "" { - r.Error = aws.ErrMissingEndpoint - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go deleted file mode 100644 index c2bc2158..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package ec2metadata_test - -import ( - "net/http" - "net/http/httptest" - "sync" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/stretchr/testify/assert" -) - -func TestClientOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(unit.Session) - - assert.NotEqual(t, http.DefaultClient, svc.Config.HTTPClient) - assert.Equal(t, 5*time.Second, svc.Config.HTTPClient.Timeout) -} - -func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { - http.DefaultClient.Transport = &http.Transport{} - defer func() { - http.DefaultClient.Transport = nil - }() - - svc := ec2metadata.New(unit.Session) - - assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) - - tr, ok := svc.Config.HTTPClient.Transport.(*http.Transport) - assert.True(t, ok) - assert.NotNil(t, tr) - assert.Nil(t, tr.Dial) -} - -func TestClientDisableOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(unit.Session, aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true)) - - assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) -} - -func TestClientOverrideDefaultHTTPClientTimeoutRace(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("us-east-1a")) - })) - - cfg := aws.NewConfig().WithEndpoint(server.URL) - runEC2MetadataClients(t, cfg, 100) -} - -func TestClientOverrideDefaultHTTPClientTimeoutRaceWithTransport(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("us-east-1a")) - })) - - cfg := aws.NewConfig().WithEndpoint(server.URL).WithHTTPClient(&http.Client{ - Transport: http.DefaultTransport, - }) - - runEC2MetadataClients(t, cfg, 100) -} - -func runEC2MetadataClients(t *testing.T, cfg *aws.Config, atOnce int) { - var wg sync.WaitGroup - wg.Add(atOnce) - for i := 0; i < atOnce; i++ { - go func() { - svc := ec2metadata.New(unit.Session, cfg) - _, err := svc.Region() - assert.NoError(t, err) - wg.Done() - }() - } - wg.Wait() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go deleted file mode 100644 index 74f72de0..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go +++ /dev/null @@ -1,133 +0,0 @@ -package endpoints - -import ( - "encoding/json" - "fmt" - "io" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -type modelDefinition map[string]json.RawMessage - -// A DecodeModelOptions are the options for how the endpoints model definition -// are decoded. -type DecodeModelOptions struct { - SkipCustomizations bool -} - -// Set combines all of the option functions together. -func (d *DecodeModelOptions) Set(optFns ...func(*DecodeModelOptions)) { - for _, fn := range optFns { - fn(d) - } -} - -// DecodeModel unmarshals a Regions and Endpoint model definition file into -// a endpoint Resolver. If the file format is not supported, or an error occurs -// when unmarshaling the model an error will be returned. -// -// Casting the return value of this func to a EnumPartitions will -// allow you to get a list of the partitions in the order the endpoints -// will be resolved in. -// -// resolver, err := endpoints.DecodeModel(reader) -// -// partitions := resolver.(endpoints.EnumPartitions).Partitions() -// for _, p := range partitions { -// // ... inspect partitions -// } -func DecodeModel(r io.Reader, optFns ...func(*DecodeModelOptions)) (Resolver, error) { - var opts DecodeModelOptions - opts.Set(optFns...) - - // Get the version of the partition file to determine what - // unmarshaling model to use. - modelDef := modelDefinition{} - if err := json.NewDecoder(r).Decode(&modelDef); err != nil { - return nil, newDecodeModelError("failed to decode endpoints model", err) - } - - var version string - if b, ok := modelDef["version"]; ok { - version = string(b) - } else { - return nil, newDecodeModelError("endpoints version not found in model", nil) - } - - if version == "3" { - return decodeV3Endpoints(modelDef, opts) - } - - return nil, newDecodeModelError( - fmt.Sprintf("endpoints version %s, not supported", version), nil) -} - -func decodeV3Endpoints(modelDef modelDefinition, opts DecodeModelOptions) (Resolver, error) { - b, ok := modelDef["partitions"] - if !ok { - return nil, newDecodeModelError("endpoints model missing partitions", nil) - } - - ps := partitions{} - if err := json.Unmarshal(b, &ps); err != nil { - return nil, newDecodeModelError("failed to decode endpoints model", err) - } - - if opts.SkipCustomizations { - return ps, nil - } - - // Customization - for i := 0; i < len(ps); i++ { - p := &ps[i] - custAddEC2Metadata(p) - custAddS3DualStack(p) - custRmIotDataService(p) - } - - return ps, nil -} - -func custAddS3DualStack(p *partition) { - if p.ID != "aws" { - return - } - - s, ok := p.Services["s3"] - if !ok { - return - } - - s.Defaults.HasDualStack = boxedTrue - s.Defaults.DualStackHostname = "{service}.dualstack.{region}.{dnsSuffix}" - - p.Services["s3"] = s -} - -func custAddEC2Metadata(p *partition) { - p.Services["ec2metadata"] = service{ - IsRegionalized: boxedFalse, - PartitionEndpoint: "aws-global", - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - } -} - -func custRmIotDataService(p *partition) { - delete(p.Services, "data.iot") -} - -type decodeModelError struct { - awsError -} - -func newDecodeModelError(msg string, err error) decodeModelError { - return decodeModelError{ - awsError: awserr.New("DecodeEndpointsModelError", msg, err), - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go deleted file mode 100644 index 31939072..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package endpoints - -import ( - "strings" - "testing" -) - -func TestDecodeEndpoints_V3(t *testing.T) { - const v3Doc = ` -{ - "version": 3, - "partitions": [ - { - "defaults": { - "hostname": "{service}.{region}.{dnsSuffix}", - "protocols": [ - "https" - ], - "signatureVersions": [ - "v4" - ] - }, - "dnsSuffix": "amazonaws.com", - "partition": "aws", - "partitionName": "AWS Standard", - "regionRegex": "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$", - "regions": { - "ap-northeast-1": { - "description": "Asia Pacific (Tokyo)" - } - }, - "services": { - "acm": { - "endpoints": { - "ap-northeast-1": {} - } - }, - "s3": { - "endpoints": { - "ap-northeast-1": {} - } - } - } - } - ] -}` - - resolver, err := DecodeModel(strings.NewReader(v3Doc)) - if err != nil { - t.Fatalf("expected no error, got %v", err) - } - - endpoint, err := resolver.EndpointFor("acm", "ap-northeast-1") - if err != nil { - t.Fatalf("failed to resolve endpoint, %v", err) - } - - if a, e := endpoint.URL, "https://acm.ap-northeast-1.amazonaws.com"; a != e { - t.Errorf("expected %q URL got %q", e, a) - } - - p := resolver.(partitions)[0] - - s3Defaults := p.Services["s3"].Defaults - if a, e := s3Defaults.HasDualStack, boxedTrue; a != e { - t.Errorf("expect s3 service to have dualstack enabled") - } - if a, e := s3Defaults.DualStackHostname, "{service}.dualstack.{region}.{dnsSuffix}"; a != e { - t.Errorf("expect s3 dualstack host pattern to be %q, got %q", e, a) - } - - ec2metaEndpoint := p.Services["ec2metadata"].Endpoints["aws-global"] - if a, e := ec2metaEndpoint.Hostname, "169.254.169.254/latest"; a != e { - t.Errorf("expect ec2metadata host to be %q, got %q", e, a) - } -} - -func TestDecodeEndpoints_NoPartitions(t *testing.T) { - const doc = `{ "version": 3 }` - - resolver, err := DecodeModel(strings.NewReader(doc)) - if err == nil { - t.Fatalf("expected error") - } - - if resolver != nil { - t.Errorf("expect resolver to be nil") - } -} - -func TestDecodeEndpoints_UnsupportedVersion(t *testing.T) { - const doc = `{ "version": 2 }` - - resolver, err := DecodeModel(strings.NewReader(doc)) - if err == nil { - t.Fatalf("expected error decoding model") - } - - if resolver != nil { - t.Errorf("expect resolver to be nil") - } -} - -func TestDecodeModelOptionsSet(t *testing.T) { - var actual DecodeModelOptions - actual.Set(func(o *DecodeModelOptions) { - o.SkipCustomizations = true - }) - - expect := DecodeModelOptions{ - SkipCustomizations: true, - } - - if actual != expect { - t.Errorf("expect %v options got %v", expect, actual) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go deleted file mode 100644 index 2ed37249..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ /dev/null @@ -1,2431 +0,0 @@ -// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. - -package endpoints - -import ( - "regexp" -) - -// Partition identifiers -const ( - AwsPartitionID = "aws" // AWS Standard partition. - AwsCnPartitionID = "aws-cn" // AWS China partition. - AwsUsGovPartitionID = "aws-us-gov" // AWS GovCloud (US) partition. -) - -// AWS Standard partition's regions. -const ( - ApNortheast1RegionID = "ap-northeast-1" // Asia Pacific (Tokyo). - ApNortheast2RegionID = "ap-northeast-2" // Asia Pacific (Seoul). - ApSouth1RegionID = "ap-south-1" // Asia Pacific (Mumbai). - ApSoutheast1RegionID = "ap-southeast-1" // Asia Pacific (Singapore). - ApSoutheast2RegionID = "ap-southeast-2" // Asia Pacific (Sydney). - CaCentral1RegionID = "ca-central-1" // Canada (Central). - EuCentral1RegionID = "eu-central-1" // EU (Frankfurt). - EuWest1RegionID = "eu-west-1" // EU (Ireland). - EuWest2RegionID = "eu-west-2" // EU (London). - SaEast1RegionID = "sa-east-1" // South America (Sao Paulo). - UsEast1RegionID = "us-east-1" // US East (N. Virginia). - UsEast2RegionID = "us-east-2" // US East (Ohio). - UsWest1RegionID = "us-west-1" // US West (N. California). - UsWest2RegionID = "us-west-2" // US West (Oregon). -) - -// AWS China partition's regions. -const ( - CnNorth1RegionID = "cn-north-1" // China (Beijing). -) - -// AWS GovCloud (US) partition's regions. -const ( - UsGovWest1RegionID = "us-gov-west-1" // AWS GovCloud (US). -) - -// Service identifiers -const ( - AcmServiceID = "acm" // Acm. - ApigatewayServiceID = "apigateway" // Apigateway. - ApplicationAutoscalingServiceID = "application-autoscaling" // ApplicationAutoscaling. - Appstream2ServiceID = "appstream2" // Appstream2. - AthenaServiceID = "athena" // Athena. - AutoscalingServiceID = "autoscaling" // Autoscaling. - BatchServiceID = "batch" // Batch. - BudgetsServiceID = "budgets" // Budgets. - ClouddirectoryServiceID = "clouddirectory" // Clouddirectory. - CloudformationServiceID = "cloudformation" // Cloudformation. - CloudfrontServiceID = "cloudfront" // Cloudfront. - CloudhsmServiceID = "cloudhsm" // Cloudhsm. - Cloudhsmv2ServiceID = "cloudhsmv2" // Cloudhsmv2. - CloudsearchServiceID = "cloudsearch" // Cloudsearch. - CloudtrailServiceID = "cloudtrail" // Cloudtrail. - CodebuildServiceID = "codebuild" // Codebuild. - CodecommitServiceID = "codecommit" // Codecommit. - CodedeployServiceID = "codedeploy" // Codedeploy. - CodepipelineServiceID = "codepipeline" // Codepipeline. - CodestarServiceID = "codestar" // Codestar. - CognitoIdentityServiceID = "cognito-identity" // CognitoIdentity. - CognitoIdpServiceID = "cognito-idp" // CognitoIdp. - CognitoSyncServiceID = "cognito-sync" // CognitoSync. - ConfigServiceID = "config" // Config. - CurServiceID = "cur" // Cur. - DatapipelineServiceID = "datapipeline" // Datapipeline. - DevicefarmServiceID = "devicefarm" // Devicefarm. - DirectconnectServiceID = "directconnect" // Directconnect. - DiscoveryServiceID = "discovery" // Discovery. - DmsServiceID = "dms" // Dms. - DsServiceID = "ds" // Ds. - DynamodbServiceID = "dynamodb" // Dynamodb. - Ec2ServiceID = "ec2" // Ec2. - Ec2metadataServiceID = "ec2metadata" // Ec2metadata. - EcrServiceID = "ecr" // Ecr. - EcsServiceID = "ecs" // Ecs. - ElasticacheServiceID = "elasticache" // Elasticache. - ElasticbeanstalkServiceID = "elasticbeanstalk" // Elasticbeanstalk. - ElasticfilesystemServiceID = "elasticfilesystem" // Elasticfilesystem. - ElasticloadbalancingServiceID = "elasticloadbalancing" // Elasticloadbalancing. - ElasticmapreduceServiceID = "elasticmapreduce" // Elasticmapreduce. - ElastictranscoderServiceID = "elastictranscoder" // Elastictranscoder. - EmailServiceID = "email" // Email. - EntitlementMarketplaceServiceID = "entitlement.marketplace" // EntitlementMarketplace. - EsServiceID = "es" // Es. - EventsServiceID = "events" // Events. - FirehoseServiceID = "firehose" // Firehose. - GameliftServiceID = "gamelift" // Gamelift. - GlacierServiceID = "glacier" // Glacier. - GlueServiceID = "glue" // Glue. - GreengrassServiceID = "greengrass" // Greengrass. - HealthServiceID = "health" // Health. - IamServiceID = "iam" // Iam. - ImportexportServiceID = "importexport" // Importexport. - InspectorServiceID = "inspector" // Inspector. - IotServiceID = "iot" // Iot. - KinesisServiceID = "kinesis" // Kinesis. - KinesisanalyticsServiceID = "kinesisanalytics" // Kinesisanalytics. - KmsServiceID = "kms" // Kms. - LambdaServiceID = "lambda" // Lambda. - LightsailServiceID = "lightsail" // Lightsail. - LogsServiceID = "logs" // Logs. - MachinelearningServiceID = "machinelearning" // Machinelearning. - MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. - MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. - MghServiceID = "mgh" // Mgh. - MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. - ModelsLexServiceID = "models.lex" // ModelsLex. - MonitoringServiceID = "monitoring" // Monitoring. - MturkRequesterServiceID = "mturk-requester" // MturkRequester. - OpsworksServiceID = "opsworks" // Opsworks. - OpsworksCmServiceID = "opsworks-cm" // OpsworksCm. - OrganizationsServiceID = "organizations" // Organizations. - PinpointServiceID = "pinpoint" // Pinpoint. - PollyServiceID = "polly" // Polly. - RdsServiceID = "rds" // Rds. - RedshiftServiceID = "redshift" // Redshift. - RekognitionServiceID = "rekognition" // Rekognition. - Route53ServiceID = "route53" // Route53. - Route53domainsServiceID = "route53domains" // Route53domains. - RuntimeLexServiceID = "runtime.lex" // RuntimeLex. - S3ServiceID = "s3" // S3. - SdbServiceID = "sdb" // Sdb. - ServicecatalogServiceID = "servicecatalog" // Servicecatalog. - ShieldServiceID = "shield" // Shield. - SmsServiceID = "sms" // Sms. - SnowballServiceID = "snowball" // Snowball. - SnsServiceID = "sns" // Sns. - SqsServiceID = "sqs" // Sqs. - SsmServiceID = "ssm" // Ssm. - StatesServiceID = "states" // States. - StoragegatewayServiceID = "storagegateway" // Storagegateway. - StreamsDynamodbServiceID = "streams.dynamodb" // StreamsDynamodb. - StsServiceID = "sts" // Sts. - SupportServiceID = "support" // Support. - SwfServiceID = "swf" // Swf. - TaggingServiceID = "tagging" // Tagging. - WafServiceID = "waf" // Waf. - WafRegionalServiceID = "waf-regional" // WafRegional. - WorkdocsServiceID = "workdocs" // Workdocs. - WorkspacesServiceID = "workspaces" // Workspaces. - XrayServiceID = "xray" // Xray. -) - -// DefaultResolver returns an Endpoint resolver that will be able -// to resolve endpoints for: AWS Standard, AWS China, and AWS GovCloud (US). -// -// Use DefaultPartitions() to get the list of the default partitions. -func DefaultResolver() Resolver { - return defaultPartitions -} - -// DefaultPartitions returns a list of the partitions the SDK is bundled -// with. The available partitions are: AWS Standard, AWS China, and AWS GovCloud (US). -// -// partitions := endpoints.DefaultPartitions -// for _, p := range partitions { -// // ... inspect partitions -// } -func DefaultPartitions() []Partition { - return defaultPartitions.Partitions() -} - -var defaultPartitions = partitions{ - awsPartition, - awscnPartition, - awsusgovPartition, -} - -// AwsPartition returns the Resolver for AWS Standard. -func AwsPartition() Partition { - return awsPartition.Partition() -} - -var awsPartition = partition{ - ID: "aws", - Name: "AWS Standard", - DNSSuffix: "amazonaws.com", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "ap-northeast-1": region{ - Description: "Asia Pacific (Tokyo)", - }, - "ap-northeast-2": region{ - Description: "Asia Pacific (Seoul)", - }, - "ap-south-1": region{ - Description: "Asia Pacific (Mumbai)", - }, - "ap-southeast-1": region{ - Description: "Asia Pacific (Singapore)", - }, - "ap-southeast-2": region{ - Description: "Asia Pacific (Sydney)", - }, - "ca-central-1": region{ - Description: "Canada (Central)", - }, - "eu-central-1": region{ - Description: "EU (Frankfurt)", - }, - "eu-west-1": region{ - Description: "EU (Ireland)", - }, - "eu-west-2": region{ - Description: "EU (London)", - }, - "sa-east-1": region{ - Description: "South America (Sao Paulo)", - }, - "us-east-1": region{ - Description: "US East (N. Virginia)", - }, - "us-east-2": region{ - Description: "US East (Ohio)", - }, - "us-west-1": region{ - Description: "US West (N. California)", - }, - "us-west-2": region{ - Description: "US West (Oregon)", - }, - }, - Services: services{ - "acm": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "apigateway": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "application-autoscaling": service{ - Defaults: endpoint{ - Hostname: "autoscaling.{region}.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "application-autoscaling", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "appstream2": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - CredentialScope: credentialScope{ - Service: "appstream", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "athena": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "batch": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "budgets": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "budgets.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "clouddirectory": service{ - - Endpoints: endpoints{ - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudfront": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "cloudfront.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "cloudhsm": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudhsmv2": service{ - - Endpoints: endpoints{ - "ap-southeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudsearch": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codebuild": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codecommit": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codepipeline": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codestar": service{ - - Endpoints: endpoints{ - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cognito-identity": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cognito-idp": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cognito-sync": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cur": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "datapipeline": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "devicefarm": service{ - - Endpoints: endpoints{ - "us-west-2": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "discovery": service{ - - Endpoints: endpoints{ - "us-west-2": endpoint{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ds": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "local": endpoint{ - Hostname: "localhost:8000", - Protocols: []string{"http"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ec2": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "ecr": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ecs": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticbeanstalk": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticfilesystem": service{ - - Endpoints: endpoints{ - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticmapreduce": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.{service}.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{ - SSLCommonName: "{service}.{region}.{dnsSuffix}", - }, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - SSLCommonName: "{service}.{region}.{dnsSuffix}", - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elastictranscoder": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "email": service{ - - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "entitlement.marketplace": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "aws-marketplace", - }, - }, - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "es": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "firehose": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "gamelift": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "glacier": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "glue": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "greengrass": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "iam.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "importexport": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "importexport.amazonaws.com", - SignatureVersions: []string{"v2", "v4"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - Service: "IngestionService", - }, - }, - }, - }, - "inspector": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "iot": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "execute-api", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesisanalytics": service{ - - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "lightsail": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "machinelearning": service{ - - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - }, - }, - "marketplacecommerceanalytics": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "metering.marketplace": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "aws-marketplace", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mgh": service{ - - Endpoints: endpoints{ - "us-west-2": endpoint{}, - }, - }, - "mobileanalytics": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "models.lex": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "lex", - }, - }, - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "monitoring": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mturk-requester": service{ - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "sandbox": endpoint{ - Hostname: "mturk-requester-sandbox.us-east-1.amazonaws.com", - }, - "us-east-1": endpoint{}, - }, - }, - "opsworks": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "opsworks-cm": service{ - - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "organizations": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "organizations.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "pinpoint": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "mobiletargeting", - }, - }, - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "polly": service{ - - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - SSLCommonName: "{service}.{dnsSuffix}", - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "rekognition": service{ - - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "route53": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "route53.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "route53domains": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "runtime.lex": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "lex", - }, - }, - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "s3": service{ - PartitionEndpoint: "us-east-1", - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{ - Hostname: "s3-ap-northeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{ - Hostname: "s3-ap-southeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-2": endpoint{ - Hostname: "s3-ap-southeast-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{ - Hostname: "s3-eu-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "eu-west-2": endpoint{}, - "s3-external-1": endpoint{ - Hostname: "s3-external-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "sa-east-1": endpoint{ - Hostname: "s3-sa-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-1": endpoint{ - Hostname: "s3.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{ - Hostname: "s3-us-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-2": endpoint{ - Hostname: "s3-us-west-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - }, - }, - "sdb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"v2"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - Hostname: "sdb.amazonaws.com", - }, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "servicecatalog": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "shield": service{ - IsRegionalized: boxedFalse, - Defaults: endpoint{ - SSLCommonName: "Shield.us-east-1.amazonaws.com", - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "sms": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "sns": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "sqs": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - SSLCommonName: "queue.{dnsSuffix}", - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "storagegateway": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "local": endpoint{ - Hostname: "localhost:8000", - Protocols: []string{"http"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "sts": service{ - PartitionEndpoint: "aws-global", - Defaults: endpoint{ - Hostname: "sts.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{ - Hostname: "sts.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "aws-global": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "sts-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "sts-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "sts-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "sts-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "support": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "tagging": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "waf": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "waf.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "waf-regional": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "workdocs": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "workspaces": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "xray": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - }, -} - -// AwsCnPartition returns the Resolver for AWS China. -func AwsCnPartition() Partition { - return awscnPartition.Partition() -} - -var awscnPartition = partition{ - ID: "aws-cn", - Name: "AWS China", - DNSSuffix: "amazonaws.com.cn", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^cn\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "cn-north-1": region{ - Description: "China (Beijing)", - }, - }, - Services: services{ - "application-autoscaling": service{ - Defaults: endpoint{ - Hostname: "autoscaling.{region}.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "application-autoscaling", - }, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "ec2": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "ecr": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "ecs": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "elasticbeanstalk": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "elasticmapreduce": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "es": service{}, - "events": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "glacier": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-cn-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "iam.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - }, - }, - "iot": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "execute-api", - }, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "monitoring": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "sns": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "sqs": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "storagegateway": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "tagging": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - }, -} - -// AwsUsGovPartition returns the Resolver for AWS GovCloud (US). -func AwsUsGovPartition() Partition { - return awsusgovPartition.Partition() -} - -var awsusgovPartition = partition{ - ID: "aws-us-gov", - Name: "AWS GovCloud (US)", - DNSSuffix: "amazonaws.com", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^us\\-gov\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "us-gov-west-1": region{ - Description: "AWS GovCloud (US)", - }, - }, - Services: services{ - "acm": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "apigateway": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "autoscaling": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "cloudhsm": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "dynamodb": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "ec2": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "elasticmapreduce": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "glacier": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-us-gov-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-us-gov-global": endpoint{ - Hostname: "iam.us-gov.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "monitoring": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "rekognition": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - SignatureVersions: []string{"s3", "s3v4"}, - }, - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "s3-fips-us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "s3-us-gov-west-1.amazonaws.com", - Protocols: []string{"http", "https"}, - }, - }, - }, - "sms": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "sns": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "sqs": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go deleted file mode 100644 index 84316b92..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go +++ /dev/null @@ -1,66 +0,0 @@ -// Package endpoints provides the types and functionality for defining regions -// and endpoints, as well as querying those definitions. -// -// The SDK's Regions and Endpoints metadata is code generated into the endpoints -// package, and is accessible via the DefaultResolver function. This function -// returns a endpoint Resolver will search the metadata and build an associated -// endpoint if one is found. The default resolver will search all partitions -// known by the SDK. e.g AWS Standard (aws), AWS China (aws-cn), and -// AWS GovCloud (US) (aws-us-gov). -// . -// -// Enumerating Regions and Endpoint Metadata -// -// Casting the Resolver returned by DefaultResolver to a EnumPartitions interface -// will allow you to get access to the list of underlying Partitions with the -// Partitions method. This is helpful if you want to limit the SDK's endpoint -// resolving to a single partition, or enumerate regions, services, and endpoints -// in the partition. -// -// resolver := endpoints.DefaultResolver() -// partitions := resolver.(endpoints.EnumPartitions).Partitions() -// -// for _, p := range partitions { -// fmt.Println("Regions for", p.ID()) -// for id, _ := range p.Regions() { -// fmt.Println("*", id) -// } -// -// fmt.Println("Services for", p.ID()) -// for id, _ := range p.Services() { -// fmt.Println("*", id) -// } -// } -// -// Using Custom Endpoints -// -// The endpoints package also gives you the ability to use your own logic how -// endpoints are resolved. This is a great way to define a custom endpoint -// for select services, without passing that logic down through your code. -// -// If a type implements the Resolver interface it can be used to resolve -// endpoints. To use this with the SDK's Session and Config set the value -// of the type to the EndpointsResolver field of aws.Config when initializing -// the session, or service client. -// -// In addition the ResolverFunc is a wrapper for a func matching the signature -// of Resolver.EndpointFor, converting it to a type that satisfies the -// Resolver interface. -// -// -// myCustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { -// if service == endpoints.S3ServiceID { -// return endpoints.ResolvedEndpoint{ -// URL: "s3.custom.endpoint.com", -// SigningRegion: "custom-signing-region", -// }, nil -// } -// -// return endpoints.DefaultResolver().EndpointFor(service, region, optFns...) -// } -// -// sess := session.Must(session.NewSession(&aws.Config{ -// Region: aws.String("us-west-2"), -// EndpointResolver: endpoints.ResolverFunc(myCustomResolver), -// })) -package endpoints diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go deleted file mode 100644 index 9c3eedb4..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go +++ /dev/null @@ -1,439 +0,0 @@ -package endpoints - -import ( - "fmt" - "regexp" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// Options provide the configuration needed to direct how the -// endpoints will be resolved. -type Options struct { - // DisableSSL forces the endpoint to be resolved as HTTP. - // instead of HTTPS if the service supports it. - DisableSSL bool - - // Sets the resolver to resolve the endpoint as a dualstack endpoint - // for the service. If dualstack support for a service is not known and - // StrictMatching is not enabled a dualstack endpoint for the service will - // be returned. This endpoint may not be valid. If StrictMatching is - // enabled only services that are known to support dualstack will return - // dualstack endpoints. - UseDualStack bool - - // Enables strict matching of services and regions resolved endpoints. - // If the partition doesn't enumerate the exact service and region an - // error will be returned. This option will prevent returning endpoints - // that look valid, but may not resolve to any real endpoint. - StrictMatching bool - - // Enables resolving a service endpoint based on the region provided if the - // service does not exist. The service endpoint ID will be used as the service - // domain name prefix. By default the endpoint resolver requires the service - // to be known when resolving endpoints. - // - // If resolving an endpoint on the partition list the provided region will - // be used to determine which partition's domain name pattern to the service - // endpoint ID with. If both the service and region are unkonwn and resolving - // the endpoint on partition list an UnknownEndpointError error will be returned. - // - // If resolving and endpoint on a partition specific resolver that partition's - // domain name pattern will be used with the service endpoint ID. If both - // region and service do not exist when resolving an endpoint on a specific - // partition the partition's domain pattern will be used to combine the - // endpoint and region together. - // - // This option is ignored if StrictMatching is enabled. - ResolveUnknownService bool -} - -// Set combines all of the option functions together. -func (o *Options) Set(optFns ...func(*Options)) { - for _, fn := range optFns { - fn(o) - } -} - -// DisableSSLOption sets the DisableSSL options. Can be used as a functional -// option when resolving endpoints. -func DisableSSLOption(o *Options) { - o.DisableSSL = true -} - -// UseDualStackOption sets the UseDualStack option. Can be used as a functional -// option when resolving endpoints. -func UseDualStackOption(o *Options) { - o.UseDualStack = true -} - -// StrictMatchingOption sets the StrictMatching option. Can be used as a functional -// option when resolving endpoints. -func StrictMatchingOption(o *Options) { - o.StrictMatching = true -} - -// ResolveUnknownServiceOption sets the ResolveUnknownService option. Can be used -// as a functional option when resolving endpoints. -func ResolveUnknownServiceOption(o *Options) { - o.ResolveUnknownService = true -} - -// A Resolver provides the interface for functionality to resolve endpoints. -// The build in Partition and DefaultResolver return value satisfy this interface. -type Resolver interface { - EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) -} - -// ResolverFunc is a helper utility that wraps a function so it satisfies the -// Resolver interface. This is useful when you want to add additional endpoint -// resolving logic, or stub out specific endpoints with custom values. -type ResolverFunc func(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) - -// EndpointFor wraps the ResolverFunc function to satisfy the Resolver interface. -func (fn ResolverFunc) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return fn(service, region, opts...) -} - -var schemeRE = regexp.MustCompile("^([^:]+)://") - -// AddScheme adds the HTTP or HTTPS schemes to a endpoint URL if there is no -// scheme. If disableSSL is true HTTP will set HTTP instead of the default HTTPS. -// -// If disableSSL is set, it will only set the URL's scheme if the URL does not -// contain a scheme. -func AddScheme(endpoint string, disableSSL bool) string { - if !schemeRE.MatchString(endpoint) { - scheme := "https" - if disableSSL { - scheme = "http" - } - endpoint = fmt.Sprintf("%s://%s", scheme, endpoint) - } - - return endpoint -} - -// EnumPartitions a provides a way to retrieve the underlying partitions that -// make up the SDK's default Resolver, or any resolver decoded from a model -// file. -// -// Use this interface with DefaultResolver and DecodeModels to get the list of -// Partitions. -type EnumPartitions interface { - Partitions() []Partition -} - -// RegionsForService returns a map of regions for the partition and service. -// If either the partition or service does not exist false will be returned -// as the second parameter. -// -// This example shows how to get the regions for DynamoDB in the AWS partition. -// rs, exists := endpoints.RegionsForService(endpoints.DefaultPartitions(), endpoints.AwsPartitionID, endpoints.DynamodbServiceID) -// -// This is equivalent to using the partition directly. -// rs := endpoints.AwsPartition().Services()[endpoints.DynamodbServiceID].Regions() -func RegionsForService(ps []Partition, partitionID, serviceID string) (map[string]Region, bool) { - for _, p := range ps { - if p.ID() != partitionID { - continue - } - if _, ok := p.p.Services[serviceID]; !ok { - break - } - - s := Service{ - id: serviceID, - p: p.p, - } - return s.Regions(), true - } - - return map[string]Region{}, false -} - -// PartitionForRegion returns the first partition which includes the region -// passed in. This includes both known regions and regions which match -// a pattern supported by the partition which may include regions that are -// not explicitly known by the partition. Use the Regions method of the -// returned Partition if explicit support is needed. -func PartitionForRegion(ps []Partition, regionID string) (Partition, bool) { - for _, p := range ps { - if _, ok := p.p.Regions[regionID]; ok || p.p.RegionRegex.MatchString(regionID) { - return p, true - } - } - - return Partition{}, false -} - -// A Partition provides the ability to enumerate the partition's regions -// and services. -type Partition struct { - id string - p *partition -} - -// ID returns the identifier of the partition. -func (p Partition) ID() string { return p.id } - -// EndpointFor attempts to resolve the endpoint based on service and region. -// See Options for information on configuring how the endpoint is resolved. -// -// If the service cannot be found in the metadata the UnknownServiceError -// error will be returned. This validation will occur regardless if -// StrictMatching is enabled. To enable resolving unknown services set the -// "ResolveUnknownService" option to true. When StrictMatching is disabled -// this option allows the partition resolver to resolve a endpoint based on -// the service endpoint ID provided. -// -// When resolving endpoints you can choose to enable StrictMatching. This will -// require the provided service and region to be known by the partition. -// If the endpoint cannot be strictly resolved an error will be returned. This -// mode is useful to ensure the endpoint resolved is valid. Without -// StrictMatching enabled the endpoint returned my look valid but may not work. -// StrictMatching requires the SDK to be updated if you want to take advantage -// of new regions and services expansions. -// -// Errors that can be returned. -// * UnknownServiceError -// * UnknownEndpointError -func (p Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return p.p.EndpointFor(service, region, opts...) -} - -// Regions returns a map of Regions indexed by their ID. This is useful for -// enumerating over the regions in a partition. -func (p Partition) Regions() map[string]Region { - rs := map[string]Region{} - for id := range p.p.Regions { - rs[id] = Region{ - id: id, - p: p.p, - } - } - - return rs -} - -// Services returns a map of Service indexed by their ID. This is useful for -// enumerating over the services in a partition. -func (p Partition) Services() map[string]Service { - ss := map[string]Service{} - for id := range p.p.Services { - ss[id] = Service{ - id: id, - p: p.p, - } - } - - return ss -} - -// A Region provides information about a region, and ability to resolve an -// endpoint from the context of a region, given a service. -type Region struct { - id, desc string - p *partition -} - -// ID returns the region's identifier. -func (r Region) ID() string { return r.id } - -// ResolveEndpoint resolves an endpoint from the context of the region given -// a service. See Partition.EndpointFor for usage and errors that can be returned. -func (r Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return r.p.EndpointFor(service, r.id, opts...) -} - -// Services returns a list of all services that are known to be in this region. -func (r Region) Services() map[string]Service { - ss := map[string]Service{} - for id, s := range r.p.Services { - if _, ok := s.Endpoints[r.id]; ok { - ss[id] = Service{ - id: id, - p: r.p, - } - } - } - - return ss -} - -// A Service provides information about a service, and ability to resolve an -// endpoint from the context of a service, given a region. -type Service struct { - id string - p *partition -} - -// ID returns the identifier for the service. -func (s Service) ID() string { return s.id } - -// ResolveEndpoint resolves an endpoint from the context of a service given -// a region. See Partition.EndpointFor for usage and errors that can be returned. -func (s Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return s.p.EndpointFor(s.id, region, opts...) -} - -// Regions returns a map of Regions that the service is present in. -// -// A region is the AWS region the service exists in. Whereas a Endpoint is -// an URL that can be resolved to a instance of a service. -func (s Service) Regions() map[string]Region { - rs := map[string]Region{} - for id := range s.p.Services[s.id].Endpoints { - if _, ok := s.p.Regions[id]; ok { - rs[id] = Region{ - id: id, - p: s.p, - } - } - } - - return rs -} - -// Endpoints returns a map of Endpoints indexed by their ID for all known -// endpoints for a service. -// -// A region is the AWS region the service exists in. Whereas a Endpoint is -// an URL that can be resolved to a instance of a service. -func (s Service) Endpoints() map[string]Endpoint { - es := map[string]Endpoint{} - for id := range s.p.Services[s.id].Endpoints { - es[id] = Endpoint{ - id: id, - serviceID: s.id, - p: s.p, - } - } - - return es -} - -// A Endpoint provides information about endpoints, and provides the ability -// to resolve that endpoint for the service, and the region the endpoint -// represents. -type Endpoint struct { - id string - serviceID string - p *partition -} - -// ID returns the identifier for an endpoint. -func (e Endpoint) ID() string { return e.id } - -// ServiceID returns the identifier the endpoint belongs to. -func (e Endpoint) ServiceID() string { return e.serviceID } - -// ResolveEndpoint resolves an endpoint from the context of a service and -// region the endpoint represents. See Partition.EndpointFor for usage and -// errors that can be returned. -func (e Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error) { - return e.p.EndpointFor(e.serviceID, e.id, opts...) -} - -// A ResolvedEndpoint is an endpoint that has been resolved based on a partition -// service, and region. -type ResolvedEndpoint struct { - // The endpoint URL - URL string - - // The region that should be used for signing requests. - SigningRegion string - - // The service name that should be used for signing requests. - SigningName string - - // The signing method that should be used for signing requests. - SigningMethod string -} - -// So that the Error interface type can be included as an anonymous field -// in the requestError struct and not conflict with the error.Error() method. -type awsError awserr.Error - -// A EndpointNotFoundError is returned when in StrictMatching mode, and the -// endpoint for the service and region cannot be found in any of the partitions. -type EndpointNotFoundError struct { - awsError - Partition string - Service string - Region string -} - -// A UnknownServiceError is returned when the service does not resolve to an -// endpoint. Includes a list of all known services for the partition. Returned -// when a partition does not support the service. -type UnknownServiceError struct { - awsError - Partition string - Service string - Known []string -} - -// NewUnknownServiceError builds and returns UnknownServiceError. -func NewUnknownServiceError(p, s string, known []string) UnknownServiceError { - return UnknownServiceError{ - awsError: awserr.New("UnknownServiceError", - "could not resolve endpoint for unknown service", nil), - Partition: p, - Service: s, - Known: known, - } -} - -// String returns the string representation of the error. -func (e UnknownServiceError) Error() string { - extra := fmt.Sprintf("partition: %q, service: %q", - e.Partition, e.Service) - if len(e.Known) > 0 { - extra += fmt.Sprintf(", known: %v", e.Known) - } - return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) -} - -// String returns the string representation of the error. -func (e UnknownServiceError) String() string { - return e.Error() -} - -// A UnknownEndpointError is returned when in StrictMatching mode and the -// service is valid, but the region does not resolve to an endpoint. Includes -// a list of all known endpoints for the service. -type UnknownEndpointError struct { - awsError - Partition string - Service string - Region string - Known []string -} - -// NewUnknownEndpointError builds and returns UnknownEndpointError. -func NewUnknownEndpointError(p, s, r string, known []string) UnknownEndpointError { - return UnknownEndpointError{ - awsError: awserr.New("UnknownEndpointError", - "could not resolve endpoint", nil), - Partition: p, - Service: s, - Region: r, - Known: known, - } -} - -// String returns the string representation of the error. -func (e UnknownEndpointError) Error() string { - extra := fmt.Sprintf("partition: %q, service: %q, region: %q", - e.Partition, e.Service, e.Region) - if len(e.Known) > 0 { - extra += fmt.Sprintf(", known: %v", e.Known) - } - return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) -} - -// String returns the string representation of the error. -func (e UnknownEndpointError) String() string { - return e.Error() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go deleted file mode 100644 index 9c0e09db..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints_test.go +++ /dev/null @@ -1,335 +0,0 @@ -package endpoints - -import "testing" - -func TestEnumDefaultPartitions(t *testing.T) { - resolver := DefaultResolver() - enum, ok := resolver.(EnumPartitions) - - if ok != true { - t.Fatalf("resolver must satisfy EnumPartition interface") - } - - ps := enum.Partitions() - - if a, e := len(ps), len(defaultPartitions); a != e { - t.Errorf("expected %d partitions, got %d", e, a) - } -} - -func TestEnumDefaultRegions(t *testing.T) { - expectPart := defaultPartitions[0] - partEnum := defaultPartitions[0].Partition() - - regEnum := partEnum.Regions() - - if a, e := len(regEnum), len(expectPart.Regions); a != e { - t.Errorf("expected %d regions, got %d", e, a) - } -} - -func TestEnumPartitionServices(t *testing.T) { - expectPart := testPartitions[0] - partEnum := testPartitions[0].Partition() - - if a, e := partEnum.ID(), "part-id"; a != e { - t.Errorf("expect %q partition ID, got %q", e, a) - } - - svcEnum := partEnum.Services() - - if a, e := len(svcEnum), len(expectPart.Services); a != e { - t.Errorf("expected %d regions, got %d", e, a) - } -} - -func TestEnumRegionServices(t *testing.T) { - p := testPartitions[0].Partition() - - rs := p.Regions() - - if a, e := len(rs), 2; a != e { - t.Errorf("expect %d regions got %d", e, a) - } - - if _, ok := rs["us-east-1"]; !ok { - t.Errorf("expect us-east-1 region to be found, was not") - } - if _, ok := rs["us-west-2"]; !ok { - t.Errorf("expect us-west-2 region to be found, was not") - } - - r := rs["us-east-1"] - - if a, e := r.ID(), "us-east-1"; a != e { - t.Errorf("expect %q region ID, got %q", e, a) - } - - ss := r.Services() - if a, e := len(ss), 1; a != e { - t.Errorf("expect %d services for us-east-1, got %d", e, a) - } - - if _, ok := ss["service1"]; !ok { - t.Errorf("expect service1 service to be found, was not") - } - - resolved, err := r.ResolveEndpoint("service1") - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if a, e := resolved.URL, "https://service1.us-east-1.amazonaws.com"; a != e { - t.Errorf("expect %q resolved URL, got %q", e, a) - } -} - -func TestEnumServiceRegions(t *testing.T) { - p := testPartitions[0].Partition() - - rs := p.Services()["service1"].Regions() - if e, a := 2, len(rs); e != a { - t.Errorf("expect %d regions, got %d", e, a) - } - - if _, ok := rs["us-east-1"]; !ok { - t.Errorf("expect region to be found") - } - if _, ok := rs["us-west-2"]; !ok { - t.Errorf("expect region to be found") - } -} - -func TestEnumServicesEndpoints(t *testing.T) { - p := testPartitions[0].Partition() - - ss := p.Services() - - if a, e := len(ss), 5; a != e { - t.Errorf("expect %d regions got %d", e, a) - } - - if _, ok := ss["service1"]; !ok { - t.Errorf("expect service1 region to be found, was not") - } - if _, ok := ss["service2"]; !ok { - t.Errorf("expect service2 region to be found, was not") - } - - s := ss["service1"] - if a, e := s.ID(), "service1"; a != e { - t.Errorf("expect %q service ID, got %q", e, a) - } - - resolved, err := s.ResolveEndpoint("us-west-2") - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if a, e := resolved.URL, "https://service1.us-west-2.amazonaws.com"; a != e { - t.Errorf("expect %q resolved URL, got %q", e, a) - } -} - -func TestEnumEndpoints(t *testing.T) { - p := testPartitions[0].Partition() - s := p.Services()["service1"] - - es := s.Endpoints() - if a, e := len(es), 2; a != e { - t.Errorf("expect %d endpoints for service2, got %d", e, a) - } - if _, ok := es["us-east-1"]; !ok { - t.Errorf("expect us-east-1 to be found, was not") - } - - e := es["us-east-1"] - if a, e := e.ID(), "us-east-1"; a != e { - t.Errorf("expect %q endpoint ID, got %q", e, a) - } - if a, e := e.ServiceID(), "service1"; a != e { - t.Errorf("expect %q service ID, got %q", e, a) - } - - resolved, err := e.ResolveEndpoint() - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if a, e := resolved.URL, "https://service1.us-east-1.amazonaws.com"; a != e { - t.Errorf("expect %q resolved URL, got %q", e, a) - } -} - -func TestResolveEndpointForPartition(t *testing.T) { - enum := testPartitions.Partitions()[0] - - expected, err := testPartitions.EndpointFor("service1", "us-east-1") - - actual, err := enum.EndpointFor("service1", "us-east-1") - if err != nil { - t.Fatalf("unexpected error, %v", err) - } - - if expected != actual { - t.Errorf("expect resolved endpoint to be %v, but got %v", expected, actual) - } -} - -func TestAddScheme(t *testing.T) { - cases := []struct { - In string - Expect string - DisableSSL bool - }{ - { - In: "https://example.com", - Expect: "https://example.com", - }, - { - In: "example.com", - Expect: "https://example.com", - }, - { - In: "http://example.com", - Expect: "http://example.com", - }, - { - In: "example.com", - Expect: "http://example.com", - DisableSSL: true, - }, - { - In: "https://example.com", - Expect: "https://example.com", - DisableSSL: true, - }, - } - - for i, c := range cases { - actual := AddScheme(c.In, c.DisableSSL) - if actual != c.Expect { - t.Errorf("%d, expect URL to be %q, got %q", i, c.Expect, actual) - } - } -} - -func TestResolverFunc(t *testing.T) { - var resolver Resolver - - resolver = ResolverFunc(func(s, r string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return ResolvedEndpoint{ - URL: "https://service.region.dnssuffix.com", - SigningRegion: "region", - SigningName: "service", - }, nil - }) - - resolved, err := resolver.EndpointFor("service", "region", func(o *Options) { - o.DisableSSL = true - }) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if a, e := resolved.URL, "https://service.region.dnssuffix.com"; a != e { - t.Errorf("expect %q endpoint URL, got %q", e, a) - } - - if a, e := resolved.SigningRegion, "region"; a != e { - t.Errorf("expect %q region, got %q", e, a) - } - if a, e := resolved.SigningName, "service"; a != e { - t.Errorf("expect %q signing name, got %q", e, a) - } -} - -func TestOptionsSet(t *testing.T) { - var actual Options - actual.Set(DisableSSLOption, UseDualStackOption, StrictMatchingOption) - - expect := Options{ - DisableSSL: true, - UseDualStack: true, - StrictMatching: true, - } - - if actual != expect { - t.Errorf("expect %v options got %v", expect, actual) - } -} - -func TestRegionsForService(t *testing.T) { - ps := DefaultPartitions() - - var expect map[string]Region - var serviceID string - for _, s := range ps[0].Services() { - expect = s.Regions() - serviceID = s.ID() - if len(expect) > 0 { - break - } - } - - actual, ok := RegionsForService(ps, ps[0].ID(), serviceID) - if !ok { - t.Fatalf("expect regions to be found, was not") - } - - if len(actual) == 0 { - t.Fatalf("expect service %s to have regions", serviceID) - } - if e, a := len(expect), len(actual); e != a { - t.Fatalf("expect %d regions, got %d", e, a) - } - - for id, r := range actual { - if e, a := id, r.ID(); e != a { - t.Errorf("expect %s region id, got %s", e, a) - } - if _, ok := expect[id]; !ok { - t.Errorf("expect %s region to be found", id) - } - } -} - -func TestRegionsForService_NotFound(t *testing.T) { - ps := testPartitions.Partitions() - - actual, ok := RegionsForService(ps, ps[0].ID(), "service-not-exists") - if ok { - t.Fatalf("expect no regions to be found, but were") - } - if len(actual) != 0 { - t.Errorf("expect no regions, got %v", actual) - } -} - -func TestPartitionForRegion(t *testing.T) { - ps := DefaultPartitions() - expect := ps[len(ps)%2] - - var regionID string - for id := range expect.Regions() { - regionID = id - break - } - - actual, ok := PartitionForRegion(ps, regionID) - if !ok { - t.Fatalf("expect partition to be found") - } - if e, a := expect.ID(), actual.ID(); e != a { - t.Errorf("expect %s partition, got %s", e, a) - } -} - -func TestPartitionForRegion_NotFound(t *testing.T) { - ps := DefaultPartitions() - - actual, ok := PartitionForRegion(ps, "regionNotExists") - if ok { - t.Errorf("expect no partition to be found, got %v", actual) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/example_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/example_test.go deleted file mode 100644 index 007fed2f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package endpoints_test - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/aws/aws-sdk-go/service/sqs" -) - -func ExampleEnumPartitions() { - resolver := endpoints.DefaultResolver() - partitions := resolver.(endpoints.EnumPartitions).Partitions() - - for _, p := range partitions { - fmt.Println("Regions for", p.ID()) - for id := range p.Regions() { - fmt.Println("*", id) - } - - fmt.Println("Services for", p.ID()) - for id := range p.Services() { - fmt.Println("*", id) - } - } -} - -func ExampleResolverFunc() { - myCustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { - if service == endpoints.S3ServiceID { - return endpoints.ResolvedEndpoint{ - URL: "s3.custom.endpoint.com", - SigningRegion: "custom-signing-region", - }, nil - } - - return endpoints.DefaultResolver().EndpointFor(service, region, optFns...) - } - - sess := session.Must(session.NewSession(&aws.Config{ - Region: aws.String("us-west-2"), - EndpointResolver: endpoints.ResolverFunc(myCustomResolver), - })) - - // Create the S3 service client with the shared session. This will - // automatically use the S3 custom endpoint configured in the custom - // endpoint resolver wrapping the default endpoint resolver. - s3Svc := s3.New(sess) - // Operation calls will be made to the custom endpoint. - s3Svc.GetObject(&s3.GetObjectInput{ - Bucket: aws.String("myBucket"), - Key: aws.String("myObjectKey"), - }) - - // Create the SQS service client with the shared session. This will - // fallback to the default endpoint resolver because the customization - // passes any non S3 service endpoint resolve to the default resolver. - sqsSvc := sqs.New(sess) - // Operation calls will be made to the default endpoint for SQS for the - // region configured. - sqsSvc.ReceiveMessage(&sqs.ReceiveMessageInput{ - QueueUrl: aws.String("my-queue-url"), - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go deleted file mode 100644 index 13d968a2..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go +++ /dev/null @@ -1,303 +0,0 @@ -package endpoints - -import ( - "fmt" - "regexp" - "strconv" - "strings" -) - -type partitions []partition - -func (ps partitions) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - var opt Options - opt.Set(opts...) - - for i := 0; i < len(ps); i++ { - if !ps[i].canResolveEndpoint(service, region, opt.StrictMatching) { - continue - } - - return ps[i].EndpointFor(service, region, opts...) - } - - // If loose matching fallback to first partition format to use - // when resolving the endpoint. - if !opt.StrictMatching && len(ps) > 0 { - return ps[0].EndpointFor(service, region, opts...) - } - - return ResolvedEndpoint{}, NewUnknownEndpointError("all partitions", service, region, []string{}) -} - -// Partitions satisfies the EnumPartitions interface and returns a list -// of Partitions representing each partition represented in the SDK's -// endpoints model. -func (ps partitions) Partitions() []Partition { - parts := make([]Partition, 0, len(ps)) - for i := 0; i < len(ps); i++ { - parts = append(parts, ps[i].Partition()) - } - - return parts -} - -type partition struct { - ID string `json:"partition"` - Name string `json:"partitionName"` - DNSSuffix string `json:"dnsSuffix"` - RegionRegex regionRegex `json:"regionRegex"` - Defaults endpoint `json:"defaults"` - Regions regions `json:"regions"` - Services services `json:"services"` -} - -func (p partition) Partition() Partition { - return Partition{ - id: p.ID, - p: &p, - } -} - -func (p partition) canResolveEndpoint(service, region string, strictMatch bool) bool { - s, hasService := p.Services[service] - _, hasEndpoint := s.Endpoints[region] - - if hasEndpoint && hasService { - return true - } - - if strictMatch { - return false - } - - return p.RegionRegex.MatchString(region) -} - -func (p partition) EndpointFor(service, region string, opts ...func(*Options)) (resolved ResolvedEndpoint, err error) { - var opt Options - opt.Set(opts...) - - s, hasService := p.Services[service] - if !(hasService || opt.ResolveUnknownService) { - // Only return error if the resolver will not fallback to creating - // endpoint based on service endpoint ID passed in. - return resolved, NewUnknownServiceError(p.ID, service, serviceList(p.Services)) - } - - e, hasEndpoint := s.endpointForRegion(region) - if !hasEndpoint && opt.StrictMatching { - return resolved, NewUnknownEndpointError(p.ID, service, region, endpointList(s.Endpoints)) - } - - defs := []endpoint{p.Defaults, s.Defaults} - return e.resolve(service, region, p.DNSSuffix, defs, opt), nil -} - -func serviceList(ss services) []string { - list := make([]string, 0, len(ss)) - for k := range ss { - list = append(list, k) - } - return list -} -func endpointList(es endpoints) []string { - list := make([]string, 0, len(es)) - for k := range es { - list = append(list, k) - } - return list -} - -type regionRegex struct { - *regexp.Regexp -} - -func (rr *regionRegex) UnmarshalJSON(b []byte) (err error) { - // Strip leading and trailing quotes - regex, err := strconv.Unquote(string(b)) - if err != nil { - return fmt.Errorf("unable to strip quotes from regex, %v", err) - } - - rr.Regexp, err = regexp.Compile(regex) - if err != nil { - return fmt.Errorf("unable to unmarshal region regex, %v", err) - } - return nil -} - -type regions map[string]region - -type region struct { - Description string `json:"description"` -} - -type services map[string]service - -type service struct { - PartitionEndpoint string `json:"partitionEndpoint"` - IsRegionalized boxedBool `json:"isRegionalized,omitempty"` - Defaults endpoint `json:"defaults"` - Endpoints endpoints `json:"endpoints"` -} - -func (s *service) endpointForRegion(region string) (endpoint, bool) { - if s.IsRegionalized == boxedFalse { - return s.Endpoints[s.PartitionEndpoint], region == s.PartitionEndpoint - } - - if e, ok := s.Endpoints[region]; ok { - return e, true - } - - // Unable to find any matching endpoint, return - // blank that will be used for generic endpoint creation. - return endpoint{}, false -} - -type endpoints map[string]endpoint - -type endpoint struct { - Hostname string `json:"hostname"` - Protocols []string `json:"protocols"` - CredentialScope credentialScope `json:"credentialScope"` - - // Custom fields not modeled - HasDualStack boxedBool `json:"-"` - DualStackHostname string `json:"-"` - - // Signature Version not used - SignatureVersions []string `json:"signatureVersions"` - - // SSLCommonName not used. - SSLCommonName string `json:"sslCommonName"` -} - -const ( - defaultProtocol = "https" - defaultSigner = "v4" -) - -var ( - protocolPriority = []string{"https", "http"} - signerPriority = []string{"v4", "v2"} -) - -func getByPriority(s []string, p []string, def string) string { - if len(s) == 0 { - return def - } - - for i := 0; i < len(p); i++ { - for j := 0; j < len(s); j++ { - if s[j] == p[i] { - return s[j] - } - } - } - - return s[0] -} - -func (e endpoint) resolve(service, region, dnsSuffix string, defs []endpoint, opts Options) ResolvedEndpoint { - var merged endpoint - for _, def := range defs { - merged.mergeIn(def) - } - merged.mergeIn(e) - e = merged - - hostname := e.Hostname - - // Offset the hostname for dualstack if enabled - if opts.UseDualStack && e.HasDualStack == boxedTrue { - hostname = e.DualStackHostname - } - - u := strings.Replace(hostname, "{service}", service, 1) - u = strings.Replace(u, "{region}", region, 1) - u = strings.Replace(u, "{dnsSuffix}", dnsSuffix, 1) - - scheme := getEndpointScheme(e.Protocols, opts.DisableSSL) - u = fmt.Sprintf("%s://%s", scheme, u) - - signingRegion := e.CredentialScope.Region - if len(signingRegion) == 0 { - signingRegion = region - } - signingName := e.CredentialScope.Service - if len(signingName) == 0 { - signingName = service - } - - return ResolvedEndpoint{ - URL: u, - SigningRegion: signingRegion, - SigningName: signingName, - SigningMethod: getByPriority(e.SignatureVersions, signerPriority, defaultSigner), - } -} - -func getEndpointScheme(protocols []string, disableSSL bool) string { - if disableSSL { - return "http" - } - - return getByPriority(protocols, protocolPriority, defaultProtocol) -} - -func (e *endpoint) mergeIn(other endpoint) { - if len(other.Hostname) > 0 { - e.Hostname = other.Hostname - } - if len(other.Protocols) > 0 { - e.Protocols = other.Protocols - } - if len(other.SignatureVersions) > 0 { - e.SignatureVersions = other.SignatureVersions - } - if len(other.CredentialScope.Region) > 0 { - e.CredentialScope.Region = other.CredentialScope.Region - } - if len(other.CredentialScope.Service) > 0 { - e.CredentialScope.Service = other.CredentialScope.Service - } - if len(other.SSLCommonName) > 0 { - e.SSLCommonName = other.SSLCommonName - } - if other.HasDualStack != boxedBoolUnset { - e.HasDualStack = other.HasDualStack - } - if len(other.DualStackHostname) > 0 { - e.DualStackHostname = other.DualStackHostname - } -} - -type credentialScope struct { - Region string `json:"region"` - Service string `json:"service"` -} - -type boxedBool int - -func (b *boxedBool) UnmarshalJSON(buf []byte) error { - v, err := strconv.ParseBool(string(buf)) - if err != nil { - return err - } - - if v { - *b = boxedTrue - } else { - *b = boxedFalse - } - - return nil -} - -const ( - boxedBoolUnset boxedBool = iota - boxedFalse - boxedTrue -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go deleted file mode 100644 index 05e92df2..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go +++ /dev/null @@ -1,337 +0,0 @@ -// +build codegen - -package endpoints - -import ( - "fmt" - "io" - "reflect" - "strings" - "text/template" - "unicode" -) - -// A CodeGenOptions are the options for code generating the endpoints into -// Go code from the endpoints model definition. -type CodeGenOptions struct { - // Options for how the model will be decoded. - DecodeModelOptions DecodeModelOptions -} - -// Set combines all of the option functions together -func (d *CodeGenOptions) Set(optFns ...func(*CodeGenOptions)) { - for _, fn := range optFns { - fn(d) - } -} - -// CodeGenModel given a endpoints model file will decode it and attempt to -// generate Go code from the model definition. Error will be returned if -// the code is unable to be generated, or decoded. -func CodeGenModel(modelFile io.Reader, outFile io.Writer, optFns ...func(*CodeGenOptions)) error { - var opts CodeGenOptions - opts.Set(optFns...) - - resolver, err := DecodeModel(modelFile, func(d *DecodeModelOptions) { - *d = opts.DecodeModelOptions - }) - if err != nil { - return err - } - - tmpl := template.Must(template.New("tmpl").Funcs(funcMap).Parse(v3Tmpl)) - if err := tmpl.ExecuteTemplate(outFile, "defaults", resolver); err != nil { - return fmt.Errorf("failed to execute template, %v", err) - } - - return nil -} - -func toSymbol(v string) string { - out := []rune{} - for _, c := range strings.Title(v) { - if !(unicode.IsNumber(c) || unicode.IsLetter(c)) { - continue - } - - out = append(out, c) - } - - return string(out) -} - -func quoteString(v string) string { - return fmt.Sprintf("%q", v) -} - -func regionConstName(p, r string) string { - return toSymbol(p) + toSymbol(r) -} - -func partitionGetter(id string) string { - return fmt.Sprintf("%sPartition", toSymbol(id)) -} - -func partitionVarName(id string) string { - return fmt.Sprintf("%sPartition", strings.ToLower(toSymbol(id))) -} - -func listPartitionNames(ps partitions) string { - names := []string{} - switch len(ps) { - case 1: - return ps[0].Name - case 2: - return fmt.Sprintf("%s and %s", ps[0].Name, ps[1].Name) - default: - for i, p := range ps { - if i == len(ps)-1 { - names = append(names, "and "+p.Name) - } else { - names = append(names, p.Name) - } - } - return strings.Join(names, ", ") - } -} - -func boxedBoolIfSet(msg string, v boxedBool) string { - switch v { - case boxedTrue: - return fmt.Sprintf(msg, "boxedTrue") - case boxedFalse: - return fmt.Sprintf(msg, "boxedFalse") - default: - return "" - } -} - -func stringIfSet(msg, v string) string { - if len(v) == 0 { - return "" - } - - return fmt.Sprintf(msg, v) -} - -func stringSliceIfSet(msg string, vs []string) string { - if len(vs) == 0 { - return "" - } - - names := []string{} - for _, v := range vs { - names = append(names, `"`+v+`"`) - } - - return fmt.Sprintf(msg, strings.Join(names, ",")) -} - -func endpointIsSet(v endpoint) bool { - return !reflect.DeepEqual(v, endpoint{}) -} - -func serviceSet(ps partitions) map[string]struct{} { - set := map[string]struct{}{} - for _, p := range ps { - for id := range p.Services { - set[id] = struct{}{} - } - } - - return set -} - -var funcMap = template.FuncMap{ - "ToSymbol": toSymbol, - "QuoteString": quoteString, - "RegionConst": regionConstName, - "PartitionGetter": partitionGetter, - "PartitionVarName": partitionVarName, - "ListPartitionNames": listPartitionNames, - "BoxedBoolIfSet": boxedBoolIfSet, - "StringIfSet": stringIfSet, - "StringSliceIfSet": stringSliceIfSet, - "EndpointIsSet": endpointIsSet, - "ServicesSet": serviceSet, -} - -const v3Tmpl = ` -{{ define "defaults" -}} -// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. - -package endpoints - -import ( - "regexp" -) - - {{ template "partition consts" . }} - - {{ range $_, $partition := . }} - {{ template "partition region consts" $partition }} - {{ end }} - - {{ template "service consts" . }} - - {{ template "endpoint resolvers" . }} -{{- end }} - -{{ define "partition consts" }} - // Partition identifiers - const ( - {{ range $_, $p := . -}} - {{ ToSymbol $p.ID }}PartitionID = {{ QuoteString $p.ID }} // {{ $p.Name }} partition. - {{ end -}} - ) -{{- end }} - -{{ define "partition region consts" }} - // {{ .Name }} partition's regions. - const ( - {{ range $id, $region := .Regions -}} - {{ ToSymbol $id }}RegionID = {{ QuoteString $id }} // {{ $region.Description }}. - {{ end -}} - ) -{{- end }} - -{{ define "service consts" }} - // Service identifiers - const ( - {{ $serviceSet := ServicesSet . -}} - {{ range $id, $_ := $serviceSet -}} - {{ ToSymbol $id }}ServiceID = {{ QuoteString $id }} // {{ ToSymbol $id }}. - {{ end -}} - ) -{{- end }} - -{{ define "endpoint resolvers" }} - // DefaultResolver returns an Endpoint resolver that will be able - // to resolve endpoints for: {{ ListPartitionNames . }}. - // - // Use DefaultPartitions() to get the list of the default partitions. - func DefaultResolver() Resolver { - return defaultPartitions - } - - // DefaultPartitions returns a list of the partitions the SDK is bundled - // with. The available partitions are: {{ ListPartitionNames . }}. - // - // partitions := endpoints.DefaultPartitions - // for _, p := range partitions { - // // ... inspect partitions - // } - func DefaultPartitions() []Partition { - return defaultPartitions.Partitions() - } - - var defaultPartitions = partitions{ - {{ range $_, $partition := . -}} - {{ PartitionVarName $partition.ID }}, - {{ end }} - } - - {{ range $_, $partition := . -}} - {{ $name := PartitionGetter $partition.ID -}} - // {{ $name }} returns the Resolver for {{ $partition.Name }}. - func {{ $name }}() Partition { - return {{ PartitionVarName $partition.ID }}.Partition() - } - var {{ PartitionVarName $partition.ID }} = {{ template "gocode Partition" $partition }} - {{ end }} -{{ end }} - -{{ define "default partitions" }} - func DefaultPartitions() []Partition { - return []partition{ - {{ range $_, $partition := . -}} - // {{ ToSymbol $partition.ID}}Partition(), - {{ end }} - } - } -{{ end }} - -{{ define "gocode Partition" -}} -partition{ - {{ StringIfSet "ID: %q,\n" .ID -}} - {{ StringIfSet "Name: %q,\n" .Name -}} - {{ StringIfSet "DNSSuffix: %q,\n" .DNSSuffix -}} - RegionRegex: {{ template "gocode RegionRegex" .RegionRegex }}, - {{ if EndpointIsSet .Defaults -}} - Defaults: {{ template "gocode Endpoint" .Defaults }}, - {{- end }} - Regions: {{ template "gocode Regions" .Regions }}, - Services: {{ template "gocode Services" .Services }}, -} -{{- end }} - -{{ define "gocode RegionRegex" -}} -regionRegex{ - Regexp: func() *regexp.Regexp{ - reg, _ := regexp.Compile({{ QuoteString .Regexp.String }}) - return reg - }(), -} -{{- end }} - -{{ define "gocode Regions" -}} -regions{ - {{ range $id, $region := . -}} - "{{ $id }}": {{ template "gocode Region" $region }}, - {{ end -}} -} -{{- end }} - -{{ define "gocode Region" -}} -region{ - {{ StringIfSet "Description: %q,\n" .Description -}} -} -{{- end }} - -{{ define "gocode Services" -}} -services{ - {{ range $id, $service := . -}} - "{{ $id }}": {{ template "gocode Service" $service }}, - {{ end }} -} -{{- end }} - -{{ define "gocode Service" -}} -service{ - {{ StringIfSet "PartitionEndpoint: %q,\n" .PartitionEndpoint -}} - {{ BoxedBoolIfSet "IsRegionalized: %s,\n" .IsRegionalized -}} - {{ if EndpointIsSet .Defaults -}} - Defaults: {{ template "gocode Endpoint" .Defaults -}}, - {{- end }} - {{ if .Endpoints -}} - Endpoints: {{ template "gocode Endpoints" .Endpoints }}, - {{- end }} -} -{{- end }} - -{{ define "gocode Endpoints" -}} -endpoints{ - {{ range $id, $endpoint := . -}} - "{{ $id }}": {{ template "gocode Endpoint" $endpoint }}, - {{ end }} -} -{{- end }} - -{{ define "gocode Endpoint" -}} -endpoint{ - {{ StringIfSet "Hostname: %q,\n" .Hostname -}} - {{ StringIfSet "SSLCommonName: %q,\n" .SSLCommonName -}} - {{ StringSliceIfSet "Protocols: []string{%s},\n" .Protocols -}} - {{ StringSliceIfSet "SignatureVersions: []string{%s},\n" .SignatureVersions -}} - {{ if or .CredentialScope.Region .CredentialScope.Service -}} - CredentialScope: credentialScope{ - {{ StringIfSet "Region: %q,\n" .CredentialScope.Region -}} - {{ StringIfSet "Service: %q,\n" .CredentialScope.Service -}} - }, - {{- end }} - {{ BoxedBoolIfSet "HasDualStack: %s,\n" .HasDualStack -}} - {{ StringIfSet "DualStackHostname: %q,\n" .DualStackHostname -}} - -} -{{- end }} -` diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_test.go deleted file mode 100644 index 1385cb42..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_test.go +++ /dev/null @@ -1,354 +0,0 @@ -package endpoints - -import ( - "encoding/json" - "regexp" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestUnmarshalRegionRegex(t *testing.T) { - var input = []byte(` -{ - "regionRegex": "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$" -}`) - - p := partition{} - err := json.Unmarshal(input, &p) - assert.NoError(t, err) - - expectRegexp, err := regexp.Compile(`^(us|eu|ap|sa|ca)\-\w+\-\d+$`) - assert.NoError(t, err) - - assert.Equal(t, expectRegexp.String(), p.RegionRegex.Regexp.String()) -} - -func TestUnmarshalRegion(t *testing.T) { - var input = []byte(` -{ - "aws-global": { - "description": "AWS partition-global endpoint" - }, - "us-east-1": { - "description": "US East (N. Virginia)" - } -}`) - - rs := regions{} - err := json.Unmarshal(input, &rs) - assert.NoError(t, err) - - assert.Len(t, rs, 2) - r, ok := rs["aws-global"] - assert.True(t, ok) - assert.Equal(t, "AWS partition-global endpoint", r.Description) - - r, ok = rs["us-east-1"] - assert.True(t, ok) - assert.Equal(t, "US East (N. Virginia)", r.Description) -} - -func TestUnmarshalServices(t *testing.T) { - var input = []byte(` -{ - "acm": { - "endpoints": { - "us-east-1": {} - } - }, - "apigateway": { - "isRegionalized": true, - "endpoints": { - "us-east-1": {}, - "us-west-2": {} - } - }, - "notRegionalized": { - "isRegionalized": false, - "endpoints": { - "us-east-1": {}, - "us-west-2": {} - } - } -}`) - - ss := services{} - err := json.Unmarshal(input, &ss) - assert.NoError(t, err) - - assert.Len(t, ss, 3) - s, ok := ss["acm"] - assert.True(t, ok) - assert.Len(t, s.Endpoints, 1) - assert.Equal(t, boxedBoolUnset, s.IsRegionalized) - - s, ok = ss["apigateway"] - assert.True(t, ok) - assert.Len(t, s.Endpoints, 2) - assert.Equal(t, boxedTrue, s.IsRegionalized) - - s, ok = ss["notRegionalized"] - assert.True(t, ok) - assert.Len(t, s.Endpoints, 2) - assert.Equal(t, boxedFalse, s.IsRegionalized) -} - -func TestUnmarshalEndpoints(t *testing.T) { - var inputs = []byte(` -{ - "aws-global": { - "hostname": "cloudfront.amazonaws.com", - "protocols": [ - "http", - "https" - ], - "signatureVersions": [ "v4" ], - "credentialScope": { - "region": "us-east-1", - "service": "serviceName" - }, - "sslCommonName": "commonName" - }, - "us-east-1": {} -}`) - - es := endpoints{} - err := json.Unmarshal(inputs, &es) - assert.NoError(t, err) - - assert.Len(t, es, 2) - s, ok := es["aws-global"] - assert.True(t, ok) - assert.Equal(t, "cloudfront.amazonaws.com", s.Hostname) - assert.Equal(t, []string{"http", "https"}, s.Protocols) - assert.Equal(t, []string{"v4"}, s.SignatureVersions) - assert.Equal(t, credentialScope{"us-east-1", "serviceName"}, s.CredentialScope) - assert.Equal(t, "commonName", s.SSLCommonName) -} - -func TestEndpointResolve(t *testing.T) { - defs := []endpoint{ - { - Hostname: "{service}.{region}.{dnsSuffix}", - SignatureVersions: []string{"v2"}, - SSLCommonName: "sslCommonName", - }, - { - Hostname: "other-hostname", - Protocols: []string{"http"}, - CredentialScope: credentialScope{ - Region: "signing_region", - Service: "signing_service", - }, - }, - } - - e := endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"v4"}, - SSLCommonName: "new sslCommonName", - } - - resolved := e.resolve("service", "region", "dnsSuffix", - defs, Options{}, - ) - - assert.Equal(t, "https://service.region.dnsSuffix", resolved.URL) - assert.Equal(t, "signing_service", resolved.SigningName) - assert.Equal(t, "signing_region", resolved.SigningRegion) - assert.Equal(t, "v4", resolved.SigningMethod) -} - -func TestEndpointMergeIn(t *testing.T) { - expected := endpoint{ - Hostname: "other hostname", - Protocols: []string{"http"}, - SignatureVersions: []string{"v4"}, - SSLCommonName: "ssl common name", - CredentialScope: credentialScope{ - Region: "region", - Service: "service", - }, - } - - actual := endpoint{} - actual.mergeIn(endpoint{ - Hostname: "other hostname", - Protocols: []string{"http"}, - SignatureVersions: []string{"v4"}, - SSLCommonName: "ssl common name", - CredentialScope: credentialScope{ - Region: "region", - Service: "service", - }, - }) - - assert.Equal(t, expected, actual) -} - -var testPartitions = partitions{ - partition{ - ID: "part-id", - Name: "partitionName", - DNSSuffix: "amazonaws.com", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "us-east-1": region{ - Description: "region description", - }, - "us-west-2": region{}, - }, - Services: services{ - "s3": service{}, - "service1": service{ - Endpoints: endpoints{ - "us-east-1": {}, - "us-west-2": { - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - }, - }, - "service2": service{}, - "httpService": service{ - Defaults: endpoint{ - Protocols: []string{"http"}, - }, - }, - "globalService": service{ - IsRegionalized: boxedFalse, - PartitionEndpoint: "aws-global", - Endpoints: endpoints{ - "aws-global": endpoint{ - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - Hostname: "globalService.amazonaws.com", - }, - }, - }, - }, - }, -} - -func TestResolveEndpoint(t *testing.T) { - resolved, err := testPartitions.EndpointFor("service2", "us-west-2") - - assert.NoError(t, err) - assert.Equal(t, "https://service2.us-west-2.amazonaws.com", resolved.URL) - assert.Equal(t, "us-west-2", resolved.SigningRegion) - assert.Equal(t, "service2", resolved.SigningName) -} - -func TestResolveEndpoint_DisableSSL(t *testing.T) { - resolved, err := testPartitions.EndpointFor("service2", "us-west-2", DisableSSLOption) - - assert.NoError(t, err) - assert.Equal(t, "http://service2.us-west-2.amazonaws.com", resolved.URL) - assert.Equal(t, "us-west-2", resolved.SigningRegion) - assert.Equal(t, "service2", resolved.SigningName) -} - -func TestResolveEndpoint_UseDualStack(t *testing.T) { - resolved, err := testPartitions.EndpointFor("service1", "us-west-2", UseDualStackOption) - - assert.NoError(t, err) - assert.Equal(t, "https://service1.dualstack.us-west-2.amazonaws.com", resolved.URL) - assert.Equal(t, "us-west-2", resolved.SigningRegion) - assert.Equal(t, "service1", resolved.SigningName) -} - -func TestResolveEndpoint_HTTPProtocol(t *testing.T) { - resolved, err := testPartitions.EndpointFor("httpService", "us-west-2") - - assert.NoError(t, err) - assert.Equal(t, "http://httpService.us-west-2.amazonaws.com", resolved.URL) - assert.Equal(t, "us-west-2", resolved.SigningRegion) - assert.Equal(t, "httpService", resolved.SigningName) -} - -func TestResolveEndpoint_UnknownService(t *testing.T) { - _, err := testPartitions.EndpointFor("unknownservice", "us-west-2") - - assert.Error(t, err) - - _, ok := err.(UnknownServiceError) - assert.True(t, ok, "expect error to be UnknownServiceError") -} - -func TestResolveEndpoint_ResolveUnknownService(t *testing.T) { - resolved, err := testPartitions.EndpointFor("unknown-service", "us-region-1", - ResolveUnknownServiceOption) - - assert.NoError(t, err) - - assert.Equal(t, "https://unknown-service.us-region-1.amazonaws.com", resolved.URL) - assert.Equal(t, "us-region-1", resolved.SigningRegion) - assert.Equal(t, "unknown-service", resolved.SigningName) -} - -func TestResolveEndpoint_UnknownMatchedRegion(t *testing.T) { - resolved, err := testPartitions.EndpointFor("service2", "us-region-1") - - assert.NoError(t, err) - assert.Equal(t, "https://service2.us-region-1.amazonaws.com", resolved.URL) - assert.Equal(t, "us-region-1", resolved.SigningRegion) - assert.Equal(t, "service2", resolved.SigningName) -} - -func TestResolveEndpoint_UnknownRegion(t *testing.T) { - resolved, err := testPartitions.EndpointFor("service2", "unknownregion") - - assert.NoError(t, err) - assert.Equal(t, "https://service2.unknownregion.amazonaws.com", resolved.URL) - assert.Equal(t, "unknownregion", resolved.SigningRegion) - assert.Equal(t, "service2", resolved.SigningName) -} - -func TestResolveEndpoint_StrictPartitionUnknownEndpoint(t *testing.T) { - _, err := testPartitions[0].EndpointFor("service2", "unknownregion", StrictMatchingOption) - - assert.Error(t, err) - - _, ok := err.(UnknownEndpointError) - assert.True(t, ok, "expect error to be UnknownEndpointError") -} - -func TestResolveEndpoint_StrictPartitionsUnknownEndpoint(t *testing.T) { - _, err := testPartitions.EndpointFor("service2", "us-region-1", StrictMatchingOption) - - assert.Error(t, err) - - _, ok := err.(UnknownEndpointError) - assert.True(t, ok, "expect error to be UnknownEndpointError") -} - -func TestResolveEndpoint_NotRegionalized(t *testing.T) { - resolved, err := testPartitions.EndpointFor("globalService", "us-west-2") - - assert.NoError(t, err) - assert.Equal(t, "https://globalService.amazonaws.com", resolved.URL) - assert.Equal(t, "us-east-1", resolved.SigningRegion) - assert.Equal(t, "globalService", resolved.SigningName) -} - -func TestResolveEndpoint_AwsGlobal(t *testing.T) { - resolved, err := testPartitions.EndpointFor("globalService", "aws-global") - - assert.NoError(t, err) - assert.Equal(t, "https://globalService.amazonaws.com", resolved.URL) - assert.Equal(t, "us-east-1", resolved.SigningRegion) - assert.Equal(t, "globalService", resolved.SigningName) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/errors.go b/vendor/github.com/aws/aws-sdk-go/aws/errors.go deleted file mode 100644 index 57663616..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -package aws - -import "github.com/aws/aws-sdk-go/aws/awserr" - -var ( - // ErrMissingRegion is an error that is returned if region configuration is - // not found. - // - // @readonly - ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) - - // ErrMissingEndpoint is an error that is returned if an endpoint cannot be - // resolved for a service. - // - // @readonly - ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go deleted file mode 100644 index 91a6f277..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go +++ /dev/null @@ -1,12 +0,0 @@ -package aws - -// JSONValue is a representation of a grab bag type that will be marshaled -// into a json string. This type can be used just like any other map. -// -// Example: -// -// values := aws.JSONValue{ -// "Foo": "Bar", -// } -// values["Baz"] = "Qux" -type JSONValue map[string]interface{} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/logger.go deleted file mode 100644 index 3babb5ab..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/logger.go +++ /dev/null @@ -1,112 +0,0 @@ -package aws - -import ( - "log" - "os" -) - -// A LogLevelType defines the level logging should be performed at. Used to instruct -// the SDK which statements should be logged. -type LogLevelType uint - -// LogLevel returns the pointer to a LogLevel. Should be used to workaround -// not being able to take the address of a non-composite literal. -func LogLevel(l LogLevelType) *LogLevelType { - return &l -} - -// Value returns the LogLevel value or the default value LogOff if the LogLevel -// is nil. Safe to use on nil value LogLevelTypes. -func (l *LogLevelType) Value() LogLevelType { - if l != nil { - return *l - } - return LogOff -} - -// Matches returns true if the v LogLevel is enabled by this LogLevel. Should be -// used with logging sub levels. Is safe to use on nil value LogLevelTypes. If -// LogLevel is nil, will default to LogOff comparison. -func (l *LogLevelType) Matches(v LogLevelType) bool { - c := l.Value() - return c&v == v -} - -// AtLeast returns true if this LogLevel is at least high enough to satisfies v. -// Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default -// to LogOff comparison. -func (l *LogLevelType) AtLeast(v LogLevelType) bool { - c := l.Value() - return c >= v -} - -const ( - // LogOff states that no logging should be performed by the SDK. This is the - // default state of the SDK, and should be use to disable all logging. - LogOff LogLevelType = iota * 0x1000 - - // LogDebug state that debug output should be logged by the SDK. This should - // be used to inspect request made and responses received. - LogDebug -) - -// Debug Logging Sub Levels -const ( - // LogDebugWithSigning states that the SDK should log request signing and - // presigning events. This should be used to log the signing details of - // requests for debugging. Will also enable LogDebug. - LogDebugWithSigning LogLevelType = LogDebug | (1 << iota) - - // LogDebugWithHTTPBody states the SDK should log HTTP request and response - // HTTP bodys in addition to the headers and path. This should be used to - // see the body content of requests and responses made while using the SDK - // Will also enable LogDebug. - LogDebugWithHTTPBody - - // LogDebugWithRequestRetries states the SDK should log when service requests will - // be retried. This should be used to log when you want to log when service - // requests are being retried. Will also enable LogDebug. - LogDebugWithRequestRetries - - // LogDebugWithRequestErrors states the SDK should log when service requests fail - // to build, send, validate, or unmarshal. - LogDebugWithRequestErrors -) - -// A Logger is a minimalistic interface for the SDK to log messages to. Should -// be used to provide custom logging writers for the SDK to use. -type Logger interface { - Log(...interface{}) -} - -// A LoggerFunc is a convenience type to convert a function taking a variadic -// list of arguments and wrap it so the Logger interface can be used. -// -// Example: -// s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { -// fmt.Fprintln(os.Stdout, args...) -// })}) -type LoggerFunc func(...interface{}) - -// Log calls the wrapped function with the arguments provided -func (f LoggerFunc) Log(args ...interface{}) { - f(args...) -} - -// NewDefaultLogger returns a Logger which will write log messages to stdout, and -// use same formatting runes as the stdlib log.Logger -func NewDefaultLogger() Logger { - return &defaultLogger{ - logger: log.New(os.Stdout, "", log.LstdFlags), - } -} - -// A defaultLogger provides a minimalistic logger satisfying the Logger interface. -type defaultLogger struct { - logger *log.Logger -} - -// Log logs the parameters to the stdlib logger. See log.Println. -func (l defaultLogger) Log(args ...interface{}) { - l.logger.Println(args...) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go deleted file mode 100644 index 271da432..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go +++ /dev/null @@ -1,19 +0,0 @@ -// +build !appengine,!plan9 - -package request - -import ( - "net" - "os" - "syscall" -) - -func isErrConnectionReset(err error) bool { - if opErr, ok := err.(*net.OpError); ok { - if sysErr, ok := opErr.Err.(*os.SyscallError); ok { - return sysErr.Err == syscall.ECONNRESET - } - } - - return false -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go deleted file mode 100644 index daf9eca4..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build appengine plan9 - -package request - -import ( - "strings" -) - -func isErrConnectionReset(err error) bool { - return strings.Contains(err.Error(), "connection reset") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go deleted file mode 100644 index aba8eb4e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other_test.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build appengine plan9 - -package request_test - -import ( - "errors" -) - -var stubConnectionResetError = errors.New("connection reset") diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go deleted file mode 100644 index bb5f6bdd..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_test.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !appengine,!plan9 - -package request_test - -import ( - "net" - "os" - "syscall" -) - -var stubConnectionResetError = &net.OpError{Err: &os.SyscallError{Syscall: "read", Err: syscall.ECONNRESET}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go deleted file mode 100644 index 802ac88a..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ /dev/null @@ -1,256 +0,0 @@ -package request - -import ( - "fmt" - "strings" -) - -// A Handlers provides a collection of request handlers for various -// stages of handling requests. -type Handlers struct { - Validate HandlerList - Build HandlerList - Sign HandlerList - Send HandlerList - ValidateResponse HandlerList - Unmarshal HandlerList - UnmarshalMeta HandlerList - UnmarshalError HandlerList - Retry HandlerList - AfterRetry HandlerList - Complete HandlerList -} - -// Copy returns of this handler's lists. -func (h *Handlers) Copy() Handlers { - return Handlers{ - Validate: h.Validate.copy(), - Build: h.Build.copy(), - Sign: h.Sign.copy(), - Send: h.Send.copy(), - ValidateResponse: h.ValidateResponse.copy(), - Unmarshal: h.Unmarshal.copy(), - UnmarshalError: h.UnmarshalError.copy(), - UnmarshalMeta: h.UnmarshalMeta.copy(), - Retry: h.Retry.copy(), - AfterRetry: h.AfterRetry.copy(), - Complete: h.Complete.copy(), - } -} - -// Clear removes callback functions for all handlers -func (h *Handlers) Clear() { - h.Validate.Clear() - h.Build.Clear() - h.Send.Clear() - h.Sign.Clear() - h.Unmarshal.Clear() - h.UnmarshalMeta.Clear() - h.UnmarshalError.Clear() - h.ValidateResponse.Clear() - h.Retry.Clear() - h.AfterRetry.Clear() - h.Complete.Clear() -} - -// A HandlerListRunItem represents an entry in the HandlerList which -// is being run. -type HandlerListRunItem struct { - Index int - Handler NamedHandler - Request *Request -} - -// A HandlerList manages zero or more handlers in a list. -type HandlerList struct { - list []NamedHandler - - // Called after each request handler in the list is called. If set - // and the func returns true the HandlerList will continue to iterate - // over the request handlers. If false is returned the HandlerList - // will stop iterating. - // - // Should be used if extra logic to be performed between each handler - // in the list. This can be used to terminate a list's iteration - // based on a condition such as error like, HandlerListStopOnError. - // Or for logging like HandlerListLogItem. - AfterEachFn func(item HandlerListRunItem) bool -} - -// A NamedHandler is a struct that contains a name and function callback. -type NamedHandler struct { - Name string - Fn func(*Request) -} - -// copy creates a copy of the handler list. -func (l *HandlerList) copy() HandlerList { - n := HandlerList{ - AfterEachFn: l.AfterEachFn, - } - if len(l.list) == 0 { - return n - } - - n.list = append(make([]NamedHandler, 0, len(l.list)), l.list...) - return n -} - -// Clear clears the handler list. -func (l *HandlerList) Clear() { - l.list = l.list[0:0] -} - -// Len returns the number of handlers in the list. -func (l *HandlerList) Len() int { - return len(l.list) -} - -// PushBack pushes handler f to the back of the handler list. -func (l *HandlerList) PushBack(f func(*Request)) { - l.PushBackNamed(NamedHandler{"__anonymous", f}) -} - -// PushBackNamed pushes named handler f to the back of the handler list. -func (l *HandlerList) PushBackNamed(n NamedHandler) { - if cap(l.list) == 0 { - l.list = make([]NamedHandler, 0, 5) - } - l.list = append(l.list, n) -} - -// PushFront pushes handler f to the front of the handler list. -func (l *HandlerList) PushFront(f func(*Request)) { - l.PushFrontNamed(NamedHandler{"__anonymous", f}) -} - -// PushFrontNamed pushes named handler f to the front of the handler list. -func (l *HandlerList) PushFrontNamed(n NamedHandler) { - if cap(l.list) == len(l.list) { - // Allocating new list required - l.list = append([]NamedHandler{n}, l.list...) - } else { - // Enough room to prepend into list. - l.list = append(l.list, NamedHandler{}) - copy(l.list[1:], l.list) - l.list[0] = n - } -} - -// Remove removes a NamedHandler n -func (l *HandlerList) Remove(n NamedHandler) { - l.RemoveByName(n.Name) -} - -// RemoveByName removes a NamedHandler by name. -func (l *HandlerList) RemoveByName(name string) { - for i := 0; i < len(l.list); i++ { - m := l.list[i] - if m.Name == name { - // Shift array preventing creating new arrays - copy(l.list[i:], l.list[i+1:]) - l.list[len(l.list)-1] = NamedHandler{} - l.list = l.list[:len(l.list)-1] - - // decrement list so next check to length is correct - i-- - } - } -} - -// SwapNamed will swap out any existing handlers with the same name as the -// passed in NamedHandler returning true if handlers were swapped. False is -// returned otherwise. -func (l *HandlerList) SwapNamed(n NamedHandler) (swapped bool) { - for i := 0; i < len(l.list); i++ { - if l.list[i].Name == n.Name { - l.list[i].Fn = n.Fn - swapped = true - } - } - - return swapped -} - -// SetBackNamed will replace the named handler if it exists in the handler list. -// If the handler does not exist the handler will be added to the end of the list. -func (l *HandlerList) SetBackNamed(n NamedHandler) { - if !l.SwapNamed(n) { - l.PushBackNamed(n) - } -} - -// SetFrontNamed will replace the named handler if it exists in the handler list. -// If the handler does not exist the handler will be added to the beginning of -// the list. -func (l *HandlerList) SetFrontNamed(n NamedHandler) { - if !l.SwapNamed(n) { - l.PushFrontNamed(n) - } -} - -// Run executes all handlers in the list with a given request object. -func (l *HandlerList) Run(r *Request) { - for i, h := range l.list { - h.Fn(r) - item := HandlerListRunItem{ - Index: i, Handler: h, Request: r, - } - if l.AfterEachFn != nil && !l.AfterEachFn(item) { - return - } - } -} - -// HandlerListLogItem logs the request handler and the state of the -// request's Error value. Always returns true to continue iterating -// request handlers in a HandlerList. -func HandlerListLogItem(item HandlerListRunItem) bool { - if item.Request.Config.Logger == nil { - return true - } - item.Request.Config.Logger.Log("DEBUG: RequestHandler", - item.Index, item.Handler.Name, item.Request.Error) - - return true -} - -// HandlerListStopOnError returns false to stop the HandlerList iterating -// over request handlers if Request.Error is not nil. True otherwise -// to continue iterating. -func HandlerListStopOnError(item HandlerListRunItem) bool { - return item.Request.Error == nil -} - -// WithAppendUserAgent will add a string to the user agent prefixed with a -// single white space. -func WithAppendUserAgent(s string) Option { - return func(r *Request) { - r.Handlers.Build.PushBack(func(r2 *Request) { - AddToUserAgent(r, s) - }) - } -} - -// MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request -// header. If the extra parameters are provided they will be added as metadata to the -// name/version pair resulting in the following format. -// "name/version (extra0; extra1; ...)" -// The user agent part will be concatenated with this current request's user agent string. -func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request) { - ua := fmt.Sprintf("%s/%s", name, version) - if len(extra) > 0 { - ua += fmt.Sprintf(" (%s)", strings.Join(extra, "; ")) - } - return func(r *Request) { - AddToUserAgent(r, ua) - } -} - -// MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header. -// The input string will be concatenated with the current request's user agent string. -func MakeAddToUserAgentFreeFormHandler(s string) func(*Request) { - return func(r *Request) { - AddToUserAgent(r, s) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go deleted file mode 100644 index b2da558d..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go +++ /dev/null @@ -1,266 +0,0 @@ -package request_test - -import ( - "reflect" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -func TestHandlerList(t *testing.T) { - s := "" - r := &request.Request{} - l := request.HandlerList{} - l.PushBack(func(r *request.Request) { - s += "a" - r.Data = s - }) - l.Run(r) - if e, a := "a", s; e != a { - t.Errorf("expect %q update got %q", e, a) - } - if e, a := "a", r.Data.(string); e != a { - t.Errorf("expect %q data update got %q", e, a) - } -} - -func TestMultipleHandlers(t *testing.T) { - r := &request.Request{} - l := request.HandlerList{} - l.PushBack(func(r *request.Request) { r.Data = nil }) - l.PushFront(func(r *request.Request) { r.Data = aws.Bool(true) }) - l.Run(r) - if r.Data != nil { - t.Error("Expected handler to execute") - } -} - -func TestNamedHandlers(t *testing.T) { - l := request.HandlerList{} - named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) {}} - named2 := request.NamedHandler{Name: "NotName", Fn: func(r *request.Request) {}} - l.PushBackNamed(named) - l.PushBackNamed(named) - l.PushBackNamed(named2) - l.PushBack(func(r *request.Request) {}) - if e, a := 4, l.Len(); e != a { - t.Errorf("expect %d list length, got %d", e, a) - } - l.Remove(named) - if e, a := 2, l.Len(); e != a { - t.Errorf("expect %d list length, got %d", e, a) - } -} - -func TestSwapHandlers(t *testing.T) { - firstHandlerCalled := 0 - swappedOutHandlerCalled := 0 - swappedInHandlerCalled := 0 - - l := request.HandlerList{} - named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { - firstHandlerCalled++ - }} - named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { - swappedOutHandlerCalled++ - }} - l.PushBackNamed(named) - l.PushBackNamed(named2) - l.PushBackNamed(named) - - l.SwapNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { - swappedInHandlerCalled++ - }}) - - l.Run(&request.Request{}) - - if e, a := 2, firstHandlerCalled; e != a { - t.Errorf("expect first handler to be called %d, was called %d times", e, a) - } - if n := swappedOutHandlerCalled; n != 0 { - t.Errorf("expect swapped out handler to not be called, was called %d times", n) - } - if e, a := 1, swappedInHandlerCalled; e != a { - t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) - } -} - -func TestSetBackNamed_Exists(t *testing.T) { - firstHandlerCalled := 0 - swappedOutHandlerCalled := 0 - swappedInHandlerCalled := 0 - - l := request.HandlerList{} - named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { - firstHandlerCalled++ - }} - named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { - swappedOutHandlerCalled++ - }} - l.PushBackNamed(named) - l.PushBackNamed(named2) - - l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { - swappedInHandlerCalled++ - }}) - - l.Run(&request.Request{}) - - if e, a := 1, firstHandlerCalled; e != a { - t.Errorf("expect first handler to be called %d, was called %d times", e, a) - } - if n := swappedOutHandlerCalled; n != 0 { - t.Errorf("expect swapped out handler to not be called, was called %d times", n) - } - if e, a := 1, swappedInHandlerCalled; e != a { - t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) - } -} - -func TestSetBackNamed_NotExists(t *testing.T) { - firstHandlerCalled := 0 - secondHandlerCalled := 0 - swappedInHandlerCalled := 0 - - l := request.HandlerList{} - named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { - firstHandlerCalled++ - }} - named2 := request.NamedHandler{Name: "OtherName", Fn: func(r *request.Request) { - secondHandlerCalled++ - }} - l.PushBackNamed(named) - l.PushBackNamed(named2) - - l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { - swappedInHandlerCalled++ - }}) - - l.Run(&request.Request{}) - - if e, a := 1, firstHandlerCalled; e != a { - t.Errorf("expect first handler to be called %d, was called %d times", e, a) - } - if e, a := 1, secondHandlerCalled; e != a { - t.Errorf("expect second handler to be called %d, was called %d times", e, a) - } - if e, a := 1, swappedInHandlerCalled; e != a { - t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) - } -} - -func TestLoggedHandlers(t *testing.T) { - expectedHandlers := []string{"name1", "name2"} - l := request.HandlerList{} - loggedHandlers := []string{} - l.AfterEachFn = request.HandlerListLogItem - cfg := aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { - loggedHandlers = append(loggedHandlers, args[2].(string)) - })} - - named1 := request.NamedHandler{Name: "name1", Fn: func(r *request.Request) {}} - named2 := request.NamedHandler{Name: "name2", Fn: func(r *request.Request) {}} - l.PushBackNamed(named1) - l.PushBackNamed(named2) - l.Run(&request.Request{Config: cfg}) - - if !reflect.DeepEqual(expectedHandlers, loggedHandlers) { - t.Errorf("expect handlers executed %v to match logged handlers, %v", - expectedHandlers, loggedHandlers) - } -} - -func TestStopHandlers(t *testing.T) { - l := request.HandlerList{} - stopAt := 1 - l.AfterEachFn = func(item request.HandlerListRunItem) bool { - return item.Index != stopAt - } - - called := 0 - l.PushBackNamed(request.NamedHandler{Name: "name1", Fn: func(r *request.Request) { - called++ - }}) - l.PushBackNamed(request.NamedHandler{Name: "name2", Fn: func(r *request.Request) { - called++ - }}) - l.PushBackNamed(request.NamedHandler{Name: "name3", Fn: func(r *request.Request) { - t.Fatalf("third handler should not be called") - }}) - l.Run(&request.Request{}) - - if e, a := 2, called; e != a { - t.Errorf("expect %d handlers called, got %d", e, a) - } -} - -func BenchmarkNewRequest(b *testing.B) { - svc := s3.New(unit.Session) - - for i := 0; i < b.N; i++ { - r, _ := svc.GetObjectRequest(nil) - if r == nil { - b.Fatal("r should not be nil") - } - } -} - -func BenchmarkHandlersCopy(b *testing.B) { - handlers := request.Handlers{} - - handlers.Validate.PushBack(func(r *request.Request) {}) - handlers.Validate.PushBack(func(r *request.Request) {}) - handlers.Build.PushBack(func(r *request.Request) {}) - handlers.Build.PushBack(func(r *request.Request) {}) - handlers.Send.PushBack(func(r *request.Request) {}) - handlers.Send.PushBack(func(r *request.Request) {}) - handlers.Unmarshal.PushBack(func(r *request.Request) {}) - handlers.Unmarshal.PushBack(func(r *request.Request) {}) - - for i := 0; i < b.N; i++ { - h := handlers.Copy() - if e, a := handlers.Validate.Len(), h.Validate.Len(); e != a { - b.Fatalf("expected %d handlers got %d", e, a) - } - } -} - -func BenchmarkHandlersPushBack(b *testing.B) { - handlers := request.Handlers{} - - for i := 0; i < b.N; i++ { - h := handlers.Copy() - h.Validate.PushBack(func(r *request.Request) {}) - h.Validate.PushBack(func(r *request.Request) {}) - h.Validate.PushBack(func(r *request.Request) {}) - h.Validate.PushBack(func(r *request.Request) {}) - } -} - -func BenchmarkHandlersPushFront(b *testing.B) { - handlers := request.Handlers{} - - for i := 0; i < b.N; i++ { - h := handlers.Copy() - h.Validate.PushFront(func(r *request.Request) {}) - h.Validate.PushFront(func(r *request.Request) {}) - h.Validate.PushFront(func(r *request.Request) {}) - h.Validate.PushFront(func(r *request.Request) {}) - } -} - -func BenchmarkHandlersClear(b *testing.B) { - handlers := request.Handlers{} - - for i := 0; i < b.N; i++ { - h := handlers.Copy() - h.Validate.PushFront(func(r *request.Request) {}) - h.Validate.PushFront(func(r *request.Request) {}) - h.Validate.PushFront(func(r *request.Request) {}) - h.Validate.PushFront(func(r *request.Request) {}) - h.Clear() - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go deleted file mode 100644 index 79f79602..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go +++ /dev/null @@ -1,24 +0,0 @@ -package request - -import ( - "io" - "net/http" - "net/url" -) - -func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { - req := new(http.Request) - *req = *r - req.URL = &url.URL{} - *req.URL = *r.URL - req.Body = body - - req.Header = http.Header{} - for k, v := range r.Header { - for _, vv := range v { - req.Header.Add(k, vv) - } - } - - return req -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_copy_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_copy_test.go deleted file mode 100644 index 4a4f8550..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_copy_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package request - -import ( - "bytes" - "io/ioutil" - "net/http" - "net/url" - "sync" - "testing" -) - -func TestRequestCopyRace(t *testing.T) { - origReq := &http.Request{URL: &url.URL{}, Header: http.Header{}} - origReq.Header.Set("Header", "OrigValue") - - var wg sync.WaitGroup - for i := 0; i < 100; i++ { - wg.Add(1) - go func() { - req := copyHTTPRequest(origReq, ioutil.NopCloser(&bytes.Buffer{})) - req.Header.Set("Header", "Value") - go func() { - req2 := copyHTTPRequest(req, ioutil.NopCloser(&bytes.Buffer{})) - req2.Header.Add("Header", "Value2") - }() - _ = req.Header.Get("Header") - wg.Done() - }() - _ = origReq.Header.Get("Header") - } - origReq.Header.Get("Header") - - wg.Wait() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go deleted file mode 100644 index 2ce9ef4c..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request_retry_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build go1.5 - -package request_test - -import ( - "errors" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/mock" - "github.com/stretchr/testify/assert" -) - -func TestRequestCancelRetry(t *testing.T) { - c := make(chan struct{}) - - reqNum := 0 - s := mock.NewMockClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.Clear() - s.Handlers.UnmarshalMeta.Clear() - s.Handlers.UnmarshalError.Clear() - s.Handlers.Send.PushFront(func(r *request.Request) { - reqNum++ - r.Error = errors.New("net/http: request canceled") - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - r.HTTPRequest.Cancel = c - close(c) - - err := r.Send() - assert.True(t, strings.Contains(err.Error(), "canceled")) - assert.Equal(t, 1, reqNum) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go deleted file mode 100644 index 02f07f4a..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go +++ /dev/null @@ -1,58 +0,0 @@ -package request - -import ( - "io" - "sync" -) - -// offsetReader is a thread-safe io.ReadCloser to prevent racing -// with retrying requests -type offsetReader struct { - buf io.ReadSeeker - lock sync.Mutex - closed bool -} - -func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { - reader := &offsetReader{} - buf.Seek(offset, 0) - - reader.buf = buf - return reader -} - -// Close will close the instance of the offset reader's access to -// the underlying io.ReadSeeker. -func (o *offsetReader) Close() error { - o.lock.Lock() - defer o.lock.Unlock() - o.closed = true - return nil -} - -// Read is a thread-safe read of the underlying io.ReadSeeker -func (o *offsetReader) Read(p []byte) (int, error) { - o.lock.Lock() - defer o.lock.Unlock() - - if o.closed { - return 0, io.EOF - } - - return o.buf.Read(p) -} - -// Seek is a thread-safe seeking operation. -func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { - o.lock.Lock() - defer o.lock.Unlock() - - return o.buf.Seek(offset, whence) -} - -// CloseAndCopy will return a new offsetReader with a copy of the old buffer -// and close the old buffer. -func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { - o.Close() - return newOffsetReader(o.buf, offset) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go deleted file mode 100644 index 01856e31..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package request - -import ( - "bytes" - "io" - "math/rand" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func TestOffsetReaderRead(t *testing.T) { - buf := []byte("testData") - reader := &offsetReader{buf: bytes.NewReader(buf)} - - tempBuf := make([]byte, len(buf)) - - n, err := reader.Read(tempBuf) - - assert.Equal(t, n, len(buf)) - assert.Nil(t, err) - assert.Equal(t, buf, tempBuf) -} - -func TestOffsetReaderSeek(t *testing.T) { - buf := []byte("testData") - reader := newOffsetReader(bytes.NewReader(buf), 0) - - orig, err := reader.Seek(0, 1) - assert.NoError(t, err) - assert.Equal(t, int64(0), orig) - - n, err := reader.Seek(0, 2) - assert.NoError(t, err) - assert.Equal(t, int64(len(buf)), n) - - n, err = reader.Seek(orig, 0) - assert.NoError(t, err) - assert.Equal(t, int64(0), n) -} - -func TestOffsetReaderClose(t *testing.T) { - buf := []byte("testData") - reader := &offsetReader{buf: bytes.NewReader(buf)} - - err := reader.Close() - assert.Nil(t, err) - - tempBuf := make([]byte, len(buf)) - n, err := reader.Read(tempBuf) - assert.Equal(t, n, 0) - assert.Equal(t, err, io.EOF) -} - -func TestOffsetReaderCloseAndCopy(t *testing.T) { - buf := []byte("testData") - tempBuf := make([]byte, len(buf)) - reader := &offsetReader{buf: bytes.NewReader(buf)} - - newReader := reader.CloseAndCopy(0) - - n, err := reader.Read(tempBuf) - assert.Equal(t, n, 0) - assert.Equal(t, err, io.EOF) - - n, err = newReader.Read(tempBuf) - assert.Equal(t, n, len(buf)) - assert.Nil(t, err) - assert.Equal(t, buf, tempBuf) -} - -func TestOffsetReaderCloseAndCopyOffset(t *testing.T) { - buf := []byte("testData") - tempBuf := make([]byte, len(buf)) - reader := &offsetReader{buf: bytes.NewReader(buf)} - - newReader := reader.CloseAndCopy(4) - n, err := newReader.Read(tempBuf) - assert.Equal(t, n, len(buf)-4) - assert.Nil(t, err) - - expected := []byte{'D', 'a', 't', 'a', 0, 0, 0, 0} - assert.Equal(t, expected, tempBuf) -} - -func TestOffsetReaderRace(t *testing.T) { - wg := sync.WaitGroup{} - - f := func(reader *offsetReader) { - defer wg.Done() - var err error - buf := make([]byte, 1) - _, err = reader.Read(buf) - for err != io.EOF { - _, err = reader.Read(buf) - } - - } - - closeFn := func(reader *offsetReader) { - defer wg.Done() - time.Sleep(time.Duration(rand.Intn(20)+1) * time.Millisecond) - reader.Close() - } - for i := 0; i < 50; i++ { - reader := &offsetReader{buf: bytes.NewReader(make([]byte, 1024*1024))} - wg.Add(1) - go f(reader) - wg.Add(1) - go closeFn(reader) - } - wg.Wait() -} - -func BenchmarkOffsetReader(b *testing.B) { - bufSize := 1024 * 1024 * 100 - buf := make([]byte, bufSize) - reader := &offsetReader{buf: bytes.NewReader(buf)} - - tempBuf := make([]byte, 1024) - - for i := 0; i < b.N; i++ { - reader.Read(tempBuf) - } -} - -func BenchmarkBytesReader(b *testing.B) { - bufSize := 1024 * 1024 * 100 - buf := make([]byte, bufSize) - reader := bytes.NewReader(buf) - - tempBuf := make([]byte, 1024) - - for i := 0; i < b.N; i++ { - reader.Read(tempBuf) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go deleted file mode 100644 index 911c058e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ /dev/null @@ -1,581 +0,0 @@ -package request - -import ( - "bytes" - "fmt" - "io" - "net" - "net/http" - "net/url" - "reflect" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client/metadata" -) - -const ( - // ErrCodeSerialization is the serialization error code that is received - // during protocol unmarshaling. - ErrCodeSerialization = "SerializationError" - - // ErrCodeRead is an error that is returned during HTTP reads. - ErrCodeRead = "ReadError" - - // ErrCodeResponseTimeout is the connection timeout error that is received - // during body reads. - ErrCodeResponseTimeout = "ResponseTimeout" - - // CanceledErrorCode is the error code that will be returned by an - // API request that was canceled. Requests given a aws.Context may - // return this error when canceled. - CanceledErrorCode = "RequestCanceled" -) - -// A Request is the service request to be made. -type Request struct { - Config aws.Config - ClientInfo metadata.ClientInfo - Handlers Handlers - - Retryer - Time time.Time - ExpireTime time.Duration - Operation *Operation - HTTPRequest *http.Request - HTTPResponse *http.Response - Body io.ReadSeeker - BodyStart int64 // offset from beginning of Body that the request body starts - Params interface{} - Error error - Data interface{} - RequestID string - RetryCount int - Retryable *bool - RetryDelay time.Duration - NotHoist bool - SignedHeaderVals http.Header - LastSignedAt time.Time - DisableFollowRedirects bool - - context aws.Context - - built bool - - // Need to persist an intermediate body between the input Body and HTTP - // request body because the HTTP Client's transport can maintain a reference - // to the HTTP request's body after the client has returned. This value is - // safe to use concurrently and wrap the input Body for each HTTP request. - safeBody *offsetReader -} - -// An Operation is the service API operation to be made. -type Operation struct { - Name string - HTTPMethod string - HTTPPath string - *Paginator - - BeforePresignFn func(r *Request) error -} - -// New returns a new Request pointer for the service API -// operation and parameters. -// -// Params is any value of input parameters to be the request payload. -// Data is pointer value to an object which the request's response -// payload will be deserialized to. -func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, - retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request { - - method := operation.HTTPMethod - if method == "" { - method = "POST" - } - - httpReq, _ := http.NewRequest(method, "", nil) - - var err error - httpReq.URL, err = url.Parse(clientInfo.Endpoint + operation.HTTPPath) - if err != nil { - httpReq.URL = &url.URL{} - err = awserr.New("InvalidEndpointURL", "invalid endpoint uri", err) - } - - r := &Request{ - Config: cfg, - ClientInfo: clientInfo, - Handlers: handlers.Copy(), - - Retryer: retryer, - Time: time.Now(), - ExpireTime: 0, - Operation: operation, - HTTPRequest: httpReq, - Body: nil, - Params: params, - Error: err, - Data: data, - } - r.SetBufferBody([]byte{}) - - return r -} - -// A Option is a functional option that can augment or modify a request when -// using a WithContext API operation method. -type Option func(*Request) - -// WithGetResponseHeader builds a request Option which will retrieve a single -// header value from the HTTP Response. If there are multiple values for the -// header key use WithGetResponseHeaders instead to access the http.Header -// map directly. The passed in val pointer must be non-nil. -// -// This Option can be used multiple times with a single API operation. -// -// var id2, versionID string -// svc.PutObjectWithContext(ctx, params, -// request.WithGetResponseHeader("x-amz-id-2", &id2), -// request.WithGetResponseHeader("x-amz-version-id", &versionID), -// ) -func WithGetResponseHeader(key string, val *string) Option { - return func(r *Request) { - r.Handlers.Complete.PushBack(func(req *Request) { - *val = req.HTTPResponse.Header.Get(key) - }) - } -} - -// WithGetResponseHeaders builds a request Option which will retrieve the -// headers from the HTTP response and assign them to the passed in headers -// variable. The passed in headers pointer must be non-nil. -// -// var headers http.Header -// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) -func WithGetResponseHeaders(headers *http.Header) Option { - return func(r *Request) { - r.Handlers.Complete.PushBack(func(req *Request) { - *headers = req.HTTPResponse.Header - }) - } -} - -// WithLogLevel is a request option that will set the request to use a specific -// log level when the request is made. -// -// svc.PutObjectWithContext(ctx, params, request.WithLogLevel(aws.LogDebugWithHTTPBody) -func WithLogLevel(l aws.LogLevelType) Option { - return func(r *Request) { - r.Config.LogLevel = aws.LogLevel(l) - } -} - -// ApplyOptions will apply each option to the request calling them in the order -// the were provided. -func (r *Request) ApplyOptions(opts ...Option) { - for _, opt := range opts { - opt(r) - } -} - -// Context will always returns a non-nil context. If Request does not have a -// context aws.BackgroundContext will be returned. -func (r *Request) Context() aws.Context { - if r.context != nil { - return r.context - } - return aws.BackgroundContext() -} - -// SetContext adds a Context to the current request that can be used to cancel -// a in-flight request. The Context value must not be nil, or this method will -// panic. -// -// Unlike http.Request.WithContext, SetContext does not return a copy of the -// Request. It is not safe to use use a single Request value for multiple -// requests. A new Request should be created for each API operation request. -// -// Go 1.6 and below: -// The http.Request's Cancel field will be set to the Done() value of -// the context. This will overwrite the Cancel field's value. -// -// Go 1.7 and above: -// The http.Request.WithContext will be used to set the context on the underlying -// http.Request. This will create a shallow copy of the http.Request. The SDK -// may create sub contexts in the future for nested requests such as retries. -func (r *Request) SetContext(ctx aws.Context) { - if ctx == nil { - panic("context cannot be nil") - } - setRequestContext(r, ctx) -} - -// WillRetry returns if the request's can be retried. -func (r *Request) WillRetry() bool { - return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() -} - -// ParamsFilled returns if the request's parameters have been populated -// and the parameters are valid. False is returned if no parameters are -// provided or invalid. -func (r *Request) ParamsFilled() bool { - return r.Params != nil && reflect.ValueOf(r.Params).Elem().IsValid() -} - -// DataFilled returns true if the request's data for response deserialization -// target has been set and is a valid. False is returned if data is not -// set, or is invalid. -func (r *Request) DataFilled() bool { - return r.Data != nil && reflect.ValueOf(r.Data).Elem().IsValid() -} - -// SetBufferBody will set the request's body bytes that will be sent to -// the service API. -func (r *Request) SetBufferBody(buf []byte) { - r.SetReaderBody(bytes.NewReader(buf)) -} - -// SetStringBody sets the body of the request to be backed by a string. -func (r *Request) SetStringBody(s string) { - r.SetReaderBody(strings.NewReader(s)) -} - -// SetReaderBody will set the request's body reader. -func (r *Request) SetReaderBody(reader io.ReadSeeker) { - r.Body = reader - r.ResetBody() -} - -// Presign returns the request's signed URL. Error will be returned -// if the signing fails. -func (r *Request) Presign(expireTime time.Duration) (string, error) { - r.ExpireTime = expireTime - r.NotHoist = false - - if r.Operation.BeforePresignFn != nil { - r = r.copy() - err := r.Operation.BeforePresignFn(r) - if err != nil { - return "", err - } - } - - r.Sign() - if r.Error != nil { - return "", r.Error - } - return r.HTTPRequest.URL.String(), nil -} - -// PresignRequest behaves just like presign, with the addition of returning a -// set of headers that were signed. -// -// Returns the URL string for the API operation with signature in the query string, -// and the HTTP headers that were included in the signature. These headers must -// be included in any HTTP request made with the presigned URL. -// -// To prevent hoisting any headers to the query string set NotHoist to true on -// this Request value prior to calling PresignRequest. -func (r *Request) PresignRequest(expireTime time.Duration) (string, http.Header, error) { - r.ExpireTime = expireTime - r.Sign() - if r.Error != nil { - return "", nil, r.Error - } - return r.HTTPRequest.URL.String(), r.SignedHeaderVals, nil -} - -func debugLogReqError(r *Request, stage string, retrying bool, err error) { - if !r.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { - return - } - - retryStr := "not retrying" - if retrying { - retryStr = "will retry" - } - - r.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", - stage, r.ClientInfo.ServiceName, r.Operation.Name, retryStr, err)) -} - -// Build will build the request's object so it can be signed and sent -// to the service. Build will also validate all the request's parameters. -// Anny additional build Handlers set on this request will be run -// in the order they were set. -// -// The request will only be built once. Multiple calls to build will have -// no effect. -// -// If any Validate or Build errors occur the build will stop and the error -// which occurred will be returned. -func (r *Request) Build() error { - if !r.built { - r.Handlers.Validate.Run(r) - if r.Error != nil { - debugLogReqError(r, "Validate Request", false, r.Error) - return r.Error - } - r.Handlers.Build.Run(r) - if r.Error != nil { - debugLogReqError(r, "Build Request", false, r.Error) - return r.Error - } - r.built = true - } - - return r.Error -} - -// Sign will sign the request returning error if errors are encountered. -// -// Send will build the request prior to signing. All Sign Handlers will -// be executed in the order they were set. -func (r *Request) Sign() error { - r.Build() - if r.Error != nil { - debugLogReqError(r, "Build Request", false, r.Error) - return r.Error - } - - r.Handlers.Sign.Run(r) - return r.Error -} - -func (r *Request) getNextRequestBody() (io.ReadCloser, error) { - if r.safeBody != nil { - r.safeBody.Close() - } - - r.safeBody = newOffsetReader(r.Body, r.BodyStart) - - // Go 1.8 tightened and clarified the rules code needs to use when building - // requests with the http package. Go 1.8 removed the automatic detection - // of if the Request.Body was empty, or actually had bytes in it. The SDK - // always sets the Request.Body even if it is empty and should not actually - // be sent. This is incorrect. - // - // Go 1.8 did add a http.NoBody value that the SDK can use to tell the http - // client that the request really should be sent without a body. The - // Request.Body cannot be set to nil, which is preferable, because the - // field is exported and could introduce nil pointer dereferences for users - // of the SDK if they used that field. - // - // Related golang/go#18257 - l, err := computeBodyLength(r.Body) - if err != nil { - return nil, awserr.New(ErrCodeSerialization, "failed to compute request body size", err) - } - - var body io.ReadCloser - if l == 0 { - body = NoBody - } else if l > 0 { - body = r.safeBody - } else { - // Hack to prevent sending bodies for methods where the body - // should be ignored by the server. Sending bodies on these - // methods without an associated ContentLength will cause the - // request to socket timeout because the server does not handle - // Transfer-Encoding: chunked bodies for these methods. - // - // This would only happen if a aws.ReaderSeekerCloser was used with - // a io.Reader that was not also an io.Seeker. - switch r.Operation.HTTPMethod { - case "GET", "HEAD", "DELETE": - body = NoBody - default: - body = r.safeBody - } - } - - return body, nil -} - -// Attempts to compute the length of the body of the reader using the -// io.Seeker interface. If the value is not seekable because of being -// a ReaderSeekerCloser without an unerlying Seeker -1 will be returned. -// If no error occurs the length of the body will be returned. -func computeBodyLength(r io.ReadSeeker) (int64, error) { - seekable := true - // Determine if the seeker is actually seekable. ReaderSeekerCloser - // hides the fact that a io.Readers might not actually be seekable. - switch v := r.(type) { - case aws.ReaderSeekerCloser: - seekable = v.IsSeeker() - case *aws.ReaderSeekerCloser: - seekable = v.IsSeeker() - } - if !seekable { - return -1, nil - } - - curOffset, err := r.Seek(0, 1) - if err != nil { - return 0, err - } - - endOffset, err := r.Seek(0, 2) - if err != nil { - return 0, err - } - - _, err = r.Seek(curOffset, 0) - if err != nil { - return 0, err - } - - return endOffset - curOffset, nil -} - -// GetBody will return an io.ReadSeeker of the Request's underlying -// input body with a concurrency safe wrapper. -func (r *Request) GetBody() io.ReadSeeker { - return r.safeBody -} - -// Send will send the request returning error if errors are encountered. -// -// Send will sign the request prior to sending. All Send Handlers will -// be executed in the order they were set. -// -// Canceling a request is non-deterministic. If a request has been canceled, -// then the transport will choose, randomly, one of the state channels during -// reads or getting the connection. -// -// readLoop() and getConn(req *Request, cm connectMethod) -// https://github.com/golang/go/blob/master/src/net/http/transport.go -// -// Send will not close the request.Request's body. -func (r *Request) Send() error { - defer func() { - // Regardless of success or failure of the request trigger the Complete - // request handlers. - r.Handlers.Complete.Run(r) - }() - - for { - if aws.BoolValue(r.Retryable) { - if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { - r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", - r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) - } - - // The previous http.Request will have a reference to the r.Body - // and the HTTP Client's Transport may still be reading from - // the request's body even though the Client's Do returned. - r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, nil) - r.ResetBody() - - // Closing response body to ensure that no response body is leaked - // between retry attempts. - if r.HTTPResponse != nil && r.HTTPResponse.Body != nil { - r.HTTPResponse.Body.Close() - } - } - - r.Sign() - if r.Error != nil { - return r.Error - } - - r.Retryable = nil - - r.Handlers.Send.Run(r) - if r.Error != nil { - if !shouldRetryCancel(r) { - return r.Error - } - - err := r.Error - r.Handlers.Retry.Run(r) - r.Handlers.AfterRetry.Run(r) - if r.Error != nil { - debugLogReqError(r, "Send Request", false, err) - return r.Error - } - debugLogReqError(r, "Send Request", true, err) - continue - } - r.Handlers.UnmarshalMeta.Run(r) - r.Handlers.ValidateResponse.Run(r) - if r.Error != nil { - r.Handlers.UnmarshalError.Run(r) - err := r.Error - - r.Handlers.Retry.Run(r) - r.Handlers.AfterRetry.Run(r) - if r.Error != nil { - debugLogReqError(r, "Validate Response", false, err) - return r.Error - } - debugLogReqError(r, "Validate Response", true, err) - continue - } - - r.Handlers.Unmarshal.Run(r) - if r.Error != nil { - err := r.Error - r.Handlers.Retry.Run(r) - r.Handlers.AfterRetry.Run(r) - if r.Error != nil { - debugLogReqError(r, "Unmarshal Response", false, err) - return r.Error - } - debugLogReqError(r, "Unmarshal Response", true, err) - continue - } - - break - } - - return nil -} - -// copy will copy a request which will allow for local manipulation of the -// request. -func (r *Request) copy() *Request { - req := &Request{} - *req = *r - req.Handlers = r.Handlers.Copy() - op := *r.Operation - req.Operation = &op - return req -} - -// AddToUserAgent adds the string to the end of the request's current user agent. -func AddToUserAgent(r *Request, s string) { - curUA := r.HTTPRequest.Header.Get("User-Agent") - if len(curUA) > 0 { - s = curUA + " " + s - } - r.HTTPRequest.Header.Set("User-Agent", s) -} - -func shouldRetryCancel(r *Request) bool { - awsErr, ok := r.Error.(awserr.Error) - timeoutErr := false - errStr := r.Error.Error() - if ok { - if awsErr.Code() == CanceledErrorCode { - return false - } - err := awsErr.OrigErr() - netErr, netOK := err.(net.Error) - timeoutErr = netOK && netErr.Temporary() - if urlErr, ok := err.(*url.Error); !timeoutErr && ok { - errStr = urlErr.Err.Error() - } - } - - // There can be two types of canceled errors here. - // The first being a net.Error and the other being an error. - // If the request was timed out, we want to continue the retry - // process. Otherwise, return the canceled error. - return timeoutErr || - (errStr != "net/http: request canceled" && - errStr != "net/http: request canceled while waiting for connection") - -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_5_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_5_test.go deleted file mode 100644 index 91b4e7b3..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_5_test.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !go1.6 - -package request_test - -import ( - "errors" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -var errTimeout = awserr.New("foo", "bar", errors.New("net/http: request canceled Timeout")) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go deleted file mode 100644 index d0314abe..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_6_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// +build go1.6 - -package request_test - -import ( - "errors" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/aws/request" -) - -// go version 1.4 and 1.5 do not return an error. Version 1.5 will url encode -// the uri while 1.4 will not -func TestRequestInvalidEndpoint(t *testing.T) { - endpoint := "http://localhost:90 " - - r := request.New( - aws.Config{}, - metadata.ClientInfo{Endpoint: endpoint}, - defaults.Handlers(), - client.DefaultRetryer{}, - &request.Operation{}, - nil, - nil, - ) - - assert.Error(t, r.Error) -} - -type timeoutErr struct { - error -} - -var errTimeout = awserr.New("foo", "bar", &timeoutErr{ - errors.New("net/http: request canceled"), -}) - -func (e *timeoutErr) Timeout() bool { - return true -} - -func (e *timeoutErr) Temporary() bool { - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go deleted file mode 100644 index 869b97a1..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build !go1.8 - -package request - -import "io" - -// NoBody is an io.ReadCloser with no bytes. Read always returns EOF -// and Close always returns nil. It can be used in an outgoing client -// request to explicitly signal that a request has zero bytes. -// An alternative, however, is to simply set Request.Body to nil. -// -// Copy of Go 1.8 NoBody type from net/http/http.go -type noBody struct{} - -func (noBody) Read([]byte) (int, error) { return 0, io.EOF } -func (noBody) Close() error { return nil } -func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } - -// NoBody is an empty reader that will trigger the Go HTTP client to not include -// and body in the HTTP request. -var NoBody = noBody{} - -// ResetBody rewinds the request body back to its starting position, and -// set's the HTTP Request body reference. When the body is read prior -// to being sent in the HTTP request it will need to be rewound. -// -// ResetBody will automatically be called by the SDK's build handler, but if -// the request is being used directly ResetBody must be called before the request -// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically -// call ResetBody. -func (r *Request) ResetBody() { - body, err := r.getNextRequestBody() - if err != nil { - r.Error = err - return - } - - r.HTTPRequest.Body = body -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7_test.go deleted file mode 100644 index ca6150cb..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7_test.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build !go1.8 - -package request - -import ( - "net/http" - "strings" - "testing" -) - -func TestResetBody_WithEmptyBody(t *testing.T) { - r := Request{ - HTTPRequest: &http.Request{}, - } - - reader := strings.NewReader("") - r.Body = reader - - r.ResetBody() - - if a, e := r.HTTPRequest.Body, (noBody{}); a != e { - t.Errorf("expected request body to be set to reader, got %#v", r.HTTPRequest.Body) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go deleted file mode 100644 index c32fc69b..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build go1.8 - -package request - -import ( - "net/http" -) - -// NoBody is a http.NoBody reader instructing Go HTTP client to not include -// and body in the HTTP request. -var NoBody = http.NoBody - -// ResetBody rewinds the request body back to its starting position, and -// set's the HTTP Request body reference. When the body is read prior -// to being sent in the HTTP request it will need to be rewound. -// -// ResetBody will automatically be called by the SDK's build handler, but if -// the request is being used directly ResetBody must be called before the request -// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically -// call ResetBody. -// -// Will also set the Go 1.8's http.Request.GetBody member to allow retrying -// PUT/POST redirects. -func (r *Request) ResetBody() { - body, err := r.getNextRequestBody() - if err != nil { - r.Error = err - return - } - - r.HTTPRequest.Body = body - r.HTTPRequest.GetBody = r.getNextRequestBody -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go deleted file mode 100644 index 8f3b0f04..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// +build go1.8 - -package request_test - -import ( - "bytes" - "io" - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" -) - -func TestResetBody_WithEmptyBody(t *testing.T) { - r := request.Request{ - HTTPRequest: &http.Request{}, - } - - reader := strings.NewReader("") - r.Body = reader - - r.ResetBody() - - if a, e := r.HTTPRequest.Body, http.NoBody; a != e { - t.Errorf("expected request body to be set to reader, got %#v", - r.HTTPRequest.Body) - } -} - -func TestRequest_FollowPUTRedirects(t *testing.T) { - const bodySize = 1024 - - redirectHit := 0 - endpointHit := 0 - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/redirect-me": - u := *r.URL - u.Path = "/endpoint" - w.Header().Set("Location", u.String()) - w.WriteHeader(307) - redirectHit++ - case "/endpoint": - b := bytes.Buffer{} - io.Copy(&b, r.Body) - r.Body.Close() - if e, a := bodySize, b.Len(); e != a { - t.Fatalf("expect %d body size, got %d", e, a) - } - endpointHit++ - default: - t.Fatalf("unexpected endpoint used, %q", r.URL.String()) - } - })) - - svc := awstesting.NewClient(&aws.Config{ - Region: unit.Session.Config.Region, - DisableSSL: aws.Bool(true), - Endpoint: aws.String(server.URL), - }) - - req := svc.NewRequest(&request.Operation{ - Name: "Operation", - HTTPMethod: "PUT", - HTTPPath: "/redirect-me", - }, &struct{}{}, &struct{}{}) - req.SetReaderBody(bytes.NewReader(make([]byte, bodySize))) - - err := req.Send() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := 1, redirectHit; e != a { - t.Errorf("expect %d redirect hits, got %d", e, a) - } - if e, a := 1, endpointHit; e != a { - t.Errorf("expect %d endpoint hits, got %d", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go deleted file mode 100644 index a7365cd1..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build go1.7 - -package request - -import "github.com/aws/aws-sdk-go/aws" - -// setContext updates the Request to use the passed in context for cancellation. -// Context will also be used for request retry delay. -// -// Creates shallow copy of the http.Request with the WithContext method. -func setRequestContext(r *Request, ctx aws.Context) { - r.context = ctx - r.HTTPRequest = r.HTTPRequest.WithContext(ctx) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go deleted file mode 100644 index 307fa070..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build !go1.7 - -package request - -import "github.com/aws/aws-sdk-go/aws" - -// setContext updates the Request to use the passed in context for cancellation. -// Context will also be used for request retry delay. -// -// Creates shallow copy of the http.Request with the WithContext method. -func setRequestContext(r *Request, ctx aws.Context) { - r.context = ctx - r.HTTPRequest.Cancel = ctx.Done() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go deleted file mode 100644 index 2af28675..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package request_test - -import ( - "fmt" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" -) - -func TestRequest_SetContext(t *testing.T) { - svc := awstesting.NewClient() - svc.Handlers.Clear() - svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) - - r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - r.SetContext(ctx) - - ctx.Error = fmt.Errorf("context canceled") - close(ctx.DoneCh) - - err := r.Send() - if err == nil { - t.Fatalf("expected error, got none") - } - - // Only check against canceled because go 1.6 will not use the context's - // Err(). - if e, a := "canceled", err.Error(); !strings.Contains(a, e) { - t.Errorf("expect %q to be in %q, but was not", e, a) - } -} - -func TestRequest_SetContextPanic(t *testing.T) { - defer func() { - if r := recover(); r == nil { - t.Fatalf("expect SetContext to panic, did not") - } - }() - r := &request.Request{} - - r.SetContext(nil) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go deleted file mode 100644 index 966f9345..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_internal_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package request - -import ( - "testing" -) - -func TestCopy(t *testing.T) { - handlers := Handlers{} - op := &Operation{} - op.HTTPMethod = "Foo" - req := &Request{} - req.Operation = op - req.Handlers = handlers - - r := req.copy() - - if r == req { - t.Fatal("expect request pointer copy to be different") - } - if r.Operation == req.Operation { - t.Errorf("expect request operation pointer to be different") - } - - if e, a := req.Operation.HTTPMethod, r.Operation.HTTPMethod; e != a { - t.Errorf("expect %q http method, got %q", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go deleted file mode 100644 index 59de6736..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go +++ /dev/null @@ -1,236 +0,0 @@ -package request - -import ( - "reflect" - "sync/atomic" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -// A Pagination provides paginating of SDK API operations which are paginatable. -// Generally you should not use this type directly, but use the "Pages" API -// operations method to automatically perform pagination for you. Such as, -// "S3.ListObjectsPages", and "S3.ListObjectsPagesWithContext" methods. -// -// Pagination differs from a Paginator type in that pagination is the type that -// does the pagination between API operations, and Paginator defines the -// configuration that will be used per page request. -// -// cont := true -// for p.Next() && cont { -// data := p.Page().(*s3.ListObjectsOutput) -// // process the page's data -// } -// return p.Err() -// -// See service client API operation Pages methods for examples how the SDK will -// use the Pagination type. -type Pagination struct { - // Function to return a Request value for each pagination request. - // Any configuration or handlers that need to be applied to the request - // prior to getting the next page should be done here before the request - // returned. - // - // NewRequest should always be built from the same API operations. It is - // undefined if different API operations are returned on subsequent calls. - NewRequest func() (*Request, error) - - started bool - nextTokens []interface{} - - err error - curPage interface{} -} - -// HasNextPage will return true if Pagination is able to determine that the API -// operation has additional pages. False will be returned if there are no more -// pages remaining. -// -// Will always return true if Next has not been called yet. -func (p *Pagination) HasNextPage() bool { - return !(p.started && len(p.nextTokens) == 0) -} - -// Err returns the error Pagination encountered when retrieving the next page. -func (p *Pagination) Err() error { - return p.err -} - -// Page returns the current page. Page should only be called after a successful -// call to Next. It is undefined what Page will return if Page is called after -// Next returns false. -func (p *Pagination) Page() interface{} { - return p.curPage -} - -// Next will attempt to retrieve the next page for the API operation. When a page -// is retrieved true will be returned. If the page cannot be retrieved, or there -// are no more pages false will be returned. -// -// Use the Page method to retrieve the current page data. The data will need -// to be cast to the API operation's output type. -// -// Use the Err method to determine if an error occurred if Page returns false. -func (p *Pagination) Next() bool { - if !p.HasNextPage() { - return false - } - - req, err := p.NewRequest() - if err != nil { - p.err = err - return false - } - - if p.started { - for i, intok := range req.Operation.InputTokens { - awsutil.SetValueAtPath(req.Params, intok, p.nextTokens[i]) - } - } - p.started = true - - err = req.Send() - if err != nil { - p.err = err - return false - } - - p.nextTokens = req.nextPageTokens() - p.curPage = req.Data - - return true -} - -// A Paginator is the configuration data that defines how an API operation -// should be paginated. This type is used by the API service models to define -// the generated pagination config for service APIs. -// -// The Pagination type is what provides iterating between pages of an API. It -// is only used to store the token metadata the SDK should use for performing -// pagination. -type Paginator struct { - InputTokens []string - OutputTokens []string - LimitToken string - TruncationToken string -} - -// nextPageTokens returns the tokens to use when asking for the next page of data. -func (r *Request) nextPageTokens() []interface{} { - if r.Operation.Paginator == nil { - return nil - } - if r.Operation.TruncationToken != "" { - tr, _ := awsutil.ValuesAtPath(r.Data, r.Operation.TruncationToken) - if len(tr) == 0 { - return nil - } - - switch v := tr[0].(type) { - case *bool: - if !aws.BoolValue(v) { - return nil - } - case bool: - if v == false { - return nil - } - } - } - - tokens := []interface{}{} - tokenAdded := false - for _, outToken := range r.Operation.OutputTokens { - v, _ := awsutil.ValuesAtPath(r.Data, outToken) - if len(v) > 0 { - tokens = append(tokens, v[0]) - tokenAdded = true - } else { - tokens = append(tokens, nil) - } - } - if !tokenAdded { - return nil - } - - return tokens -} - -// Ensure a deprecated item is only logged once instead of each time its used. -func logDeprecatedf(logger aws.Logger, flag *int32, msg string) { - if logger == nil { - return - } - if atomic.CompareAndSwapInt32(flag, 0, 1) { - logger.Log(msg) - } -} - -var ( - logDeprecatedHasNextPage int32 - logDeprecatedNextPage int32 - logDeprecatedEachPage int32 -) - -// HasNextPage returns true if this request has more pages of data available. -// -// Deprecated Use Pagination type for configurable pagination of API operations -func (r *Request) HasNextPage() bool { - logDeprecatedf(r.Config.Logger, &logDeprecatedHasNextPage, - "Request.HasNextPage deprecated. Use Pagination type for configurable pagination of API operations") - - return len(r.nextPageTokens()) > 0 -} - -// NextPage returns a new Request that can be executed to return the next -// page of result data. Call .Send() on this request to execute it. -// -// Deprecated Use Pagination type for configurable pagination of API operations -func (r *Request) NextPage() *Request { - logDeprecatedf(r.Config.Logger, &logDeprecatedNextPage, - "Request.NextPage deprecated. Use Pagination type for configurable pagination of API operations") - - tokens := r.nextPageTokens() - if len(tokens) == 0 { - return nil - } - - data := reflect.New(reflect.TypeOf(r.Data).Elem()).Interface() - nr := New(r.Config, r.ClientInfo, r.Handlers, r.Retryer, r.Operation, awsutil.CopyOf(r.Params), data) - for i, intok := range nr.Operation.InputTokens { - awsutil.SetValueAtPath(nr.Params, intok, tokens[i]) - } - return nr -} - -// EachPage iterates over each page of a paginated request object. The fn -// parameter should be a function with the following sample signature: -// -// func(page *T, lastPage bool) bool { -// return true // return false to stop iterating -// } -// -// Where "T" is the structure type matching the output structure of the given -// operation. For example, a request object generated by -// DynamoDB.ListTablesRequest() would expect to see dynamodb.ListTablesOutput -// as the structure "T". The lastPage value represents whether the page is -// the last page of data or not. The return value of this function should -// return true to keep iterating or false to stop. -// -// Deprecated Use Pagination type for configurable pagination of API operations -func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error { - logDeprecatedf(r.Config.Logger, &logDeprecatedEachPage, - "Request.EachPage deprecated. Use Pagination type for configurable pagination of API operations") - - for page := r; page != nil; page = page.NextPage() { - if err := page.Send(); err != nil { - return err - } - if getNextPage := fn(page.Data, !page.HasNextPage()); !getNextPage { - return page.Error - } - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go deleted file mode 100644 index 73a95bad..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go +++ /dev/null @@ -1,604 +0,0 @@ -package request_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/aws/aws-sdk-go/service/route53" - "github.com/aws/aws-sdk-go/service/s3" -) - -// Use DynamoDB methods for simplicity -func TestPaginationQueryPage(t *testing.T) { - db := dynamodb.New(unit.Session) - tokens, pages, numPages, gotToEnd := []map[string]*dynamodb.AttributeValue{}, []map[string]*dynamodb.AttributeValue{}, 0, false - - reqNum := 0 - resps := []*dynamodb.QueryOutput{ - { - LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}}, - Count: aws.Int64(1), - Items: []map[string]*dynamodb.AttributeValue{ - { - "key": {S: aws.String("key1")}, - }, - }, - }, - { - LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}}, - Count: aws.Int64(1), - Items: []map[string]*dynamodb.AttributeValue{ - { - "key": {S: aws.String("key2")}, - }, - }, - }, - { - LastEvaluatedKey: map[string]*dynamodb.AttributeValue{}, - Count: aws.Int64(1), - Items: []map[string]*dynamodb.AttributeValue{ - { - "key": {S: aws.String("key3")}, - }, - }, - }, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *request.Request) { - in := r.Params.(*dynamodb.QueryInput) - if in == nil { - tokens = append(tokens, nil) - } else if len(in.ExclusiveStartKey) != 0 { - tokens = append(tokens, in.ExclusiveStartKey) - } - }) - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.QueryInput{ - Limit: aws.Int64(2), - TableName: aws.String("tablename"), - } - err := db.QueryPages(params, func(p *dynamodb.QueryOutput, last bool) bool { - numPages++ - for _, item := range p.Items { - pages = append(pages, item) - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - return true - }) - assert.Nil(t, err) - - assert.Equal(t, - []map[string]*dynamodb.AttributeValue{ - {"key": {S: aws.String("key1")}}, - {"key": {S: aws.String("key2")}}, - }, tokens) - assert.Equal(t, - []map[string]*dynamodb.AttributeValue{ - {"key": {S: aws.String("key1")}}, - {"key": {S: aws.String("key2")}}, - {"key": {S: aws.String("key3")}}, - }, pages) - assert.Equal(t, 3, numPages) - assert.True(t, gotToEnd) - assert.Nil(t, params.ExclusiveStartKey) -} - -// Use DynamoDB methods for simplicity -func TestPagination(t *testing.T) { - db := dynamodb.New(unit.Session) - tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false - - reqNum := 0 - resps := []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")}, - {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")}, - {TableNames: []*string{aws.String("Table5")}}, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *request.Request) { - in := r.Params.(*dynamodb.ListTablesInput) - if in == nil { - tokens = append(tokens, "") - } else if in.ExclusiveStartTableName != nil { - tokens = append(tokens, *in.ExclusiveStartTableName) - } - }) - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool { - numPages++ - for _, t := range p.TableNames { - pages = append(pages, *t) - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - return true - }) - - assert.Equal(t, []string{"Table2", "Table4"}, tokens) - assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages) - assert.Equal(t, 3, numPages) - assert.True(t, gotToEnd) - assert.Nil(t, err) - assert.Nil(t, params.ExclusiveStartTableName) -} - -// Use DynamoDB methods for simplicity -func TestPaginationEachPage(t *testing.T) { - db := dynamodb.New(unit.Session) - tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false - - reqNum := 0 - resps := []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")}, - {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")}, - {TableNames: []*string{aws.String("Table5")}}, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *request.Request) { - in := r.Params.(*dynamodb.ListTablesInput) - if in == nil { - tokens = append(tokens, "") - } else if in.ExclusiveStartTableName != nil { - tokens = append(tokens, *in.ExclusiveStartTableName) - } - }) - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - req, _ := db.ListTablesRequest(params) - err := req.EachPage(func(p interface{}, last bool) bool { - numPages++ - for _, t := range p.(*dynamodb.ListTablesOutput).TableNames { - pages = append(pages, *t) - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - - return true - }) - - assert.Equal(t, []string{"Table2", "Table4"}, tokens) - assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages) - assert.Equal(t, 3, numPages) - assert.True(t, gotToEnd) - assert.Nil(t, err) -} - -// Use DynamoDB methods for simplicity -func TestPaginationEarlyExit(t *testing.T) { - db := dynamodb.New(unit.Session) - numPages, gotToEnd := 0, false - - reqNum := 0 - resps := []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")}, - {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")}, - {TableNames: []*string{aws.String("Table5")}}, - } - - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool { - numPages++ - if numPages == 2 { - return false - } - if last { - if gotToEnd { - assert.Fail(t, "last=true happened twice") - } - gotToEnd = true - } - return true - }) - - assert.Equal(t, 2, numPages) - assert.False(t, gotToEnd) - assert.Nil(t, err) -} - -func TestSkipPagination(t *testing.T) { - client := s3.New(unit.Session) - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = &s3.HeadBucketOutput{} - }) - - req, _ := client.HeadBucketRequest(&s3.HeadBucketInput{Bucket: aws.String("bucket")}) - - numPages, gotToEnd := 0, false - req.EachPage(func(p interface{}, last bool) bool { - numPages++ - if last { - gotToEnd = true - } - return true - }) - assert.Equal(t, 1, numPages) - assert.True(t, gotToEnd) -} - -// Use S3 for simplicity -func TestPaginationTruncation(t *testing.T) { - client := s3.New(unit.Session) - - reqNum := 0 - resps := []*s3.ListObjectsOutput{ - {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}}, - {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}}, - {IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}}, - {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}}, - } - - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &s3.ListObjectsInput{Bucket: aws.String("bucket")} - - results := []string{} - err := client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool { - results = append(results, *p.Contents[0].Key) - return true - }) - - assert.Equal(t, []string{"Key1", "Key2", "Key3"}, results) - assert.Nil(t, err) - - // Try again without truncation token at all - reqNum = 0 - resps[1].IsTruncated = nil - resps[2].IsTruncated = aws.Bool(true) - results = []string{} - err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool { - results = append(results, *p.Contents[0].Key) - return true - }) - - assert.Equal(t, []string{"Key1", "Key2"}, results) - assert.Nil(t, err) -} - -func TestPaginationNilToken(t *testing.T) { - client := route53.New(unit.Session) - - reqNum := 0 - resps := []*route53.ListResourceRecordSetsOutput{ - { - ResourceRecordSets: []*route53.ResourceRecordSet{ - {Name: aws.String("first.example.com.")}, - }, - IsTruncated: aws.Bool(true), - NextRecordName: aws.String("second.example.com."), - NextRecordType: aws.String("MX"), - NextRecordIdentifier: aws.String("second"), - MaxItems: aws.String("1"), - }, - { - ResourceRecordSets: []*route53.ResourceRecordSet{ - {Name: aws.String("second.example.com.")}, - }, - IsTruncated: aws.Bool(true), - NextRecordName: aws.String("third.example.com."), - NextRecordType: aws.String("MX"), - MaxItems: aws.String("1"), - }, - { - ResourceRecordSets: []*route53.ResourceRecordSet{ - {Name: aws.String("third.example.com.")}, - }, - IsTruncated: aws.Bool(false), - MaxItems: aws.String("1"), - }, - } - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - - idents := []string{} - client.Handlers.Build.PushBack(func(r *request.Request) { - p := r.Params.(*route53.ListResourceRecordSetsInput) - idents = append(idents, aws.StringValue(p.StartRecordIdentifier)) - - }) - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = resps[reqNum] - reqNum++ - }) - - params := &route53.ListResourceRecordSetsInput{ - HostedZoneId: aws.String("id-zone"), - } - - results := []string{} - err := client.ListResourceRecordSetsPages(params, func(p *route53.ListResourceRecordSetsOutput, last bool) bool { - results = append(results, *p.ResourceRecordSets[0].Name) - return true - }) - - assert.NoError(t, err) - assert.Equal(t, []string{"", "second", ""}, idents) - assert.Equal(t, []string{"first.example.com.", "second.example.com.", "third.example.com."}, results) -} - -func TestPaginationNilInput(t *testing.T) { - // Code generation doesn't have a great way to verify the code is correct - // other than being run via unit tests in the SDK. This should be fixed - // So code generation can be validated independently. - - client := s3.New(unit.Session) - client.Handlers.Validate.Clear() - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = &s3.ListObjectsOutput{} - }) - - gotToEnd := false - numPages := 0 - err := client.ListObjectsPages(nil, func(p *s3.ListObjectsOutput, last bool) bool { - numPages++ - if last { - gotToEnd = true - } - return true - }) - - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } - if e, a := 1, numPages; e != a { - t.Errorf("expect %d number pages but got %d", e, a) - } - if !gotToEnd { - t.Errorf("expect to of gotten to end, did not") - } -} - -func TestPaginationWithContextNilInput(t *testing.T) { - // Code generation doesn't have a great way to verify the code is correct - // other than being run via unit tests in the SDK. This should be fixed - // So code generation can be validated independently. - - client := s3.New(unit.Session) - client.Handlers.Validate.Clear() - client.Handlers.Send.Clear() // mock sending - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = &s3.ListObjectsOutput{} - }) - - gotToEnd := false - numPages := 0 - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - err := client.ListObjectsPagesWithContext(ctx, nil, func(p *s3.ListObjectsOutput, last bool) bool { - numPages++ - if last { - gotToEnd = true - } - return true - }) - - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } - if e, a := 1, numPages; e != a { - t.Errorf("expect %d number pages but got %d", e, a) - } - if !gotToEnd { - t.Errorf("expect to of gotten to end, did not") - } -} - -type testPageInput struct { - NextToken string -} -type testPageOutput struct { - Value string - NextToken *string -} - -func TestPagination_Standalone(t *testing.T) { - expect := []struct { - Value, PrevToken, NextToken string - }{ - {"FirstValue", "InitalToken", "FirstToken"}, - {"SecondValue", "FirstToken", "SecondToken"}, - {"ThirdValue", "SecondToken", ""}, - } - input := testPageInput{ - NextToken: expect[0].PrevToken, - } - - c := awstesting.NewClient() - i := 0 - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - r := c.NewRequest( - &request.Operation{ - Name: "Operation", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - }, - }, - &input, &testPageOutput{}, - ) - // Setup handlers for testing - r.Handlers.Clear() - r.Handlers.Build.PushBack(func(req *request.Request) { - in := req.Params.(*testPageInput) - if e, a := expect[i].PrevToken, in.NextToken; e != a { - t.Errorf("%d, expect NextToken input %q, got %q", i, e, a) - } - }) - r.Handlers.Unmarshal.PushBack(func(req *request.Request) { - out := &testPageOutput{ - Value: expect[i].Value, - } - if len(expect[i].NextToken) > 0 { - out.NextToken = aws.String(expect[i].NextToken) - } - req.Data = out - }) - return r, nil - }, - } - - for p.Next() { - data := p.Page().(*testPageOutput) - - if e, a := expect[i].Value, data.Value; e != a { - t.Errorf("%d, expect Value to be %q, got %q", i, e, a) - } - if e, a := expect[i].NextToken, aws.StringValue(data.NextToken); e != a { - t.Errorf("%d, expect NextToken to be %q, got %q", i, e, a) - } - - i++ - } - if e, a := len(expect), i; e != a { - t.Errorf("expected to process %d pages, did %d", e, a) - } - if err := p.Err(); err != nil { - t.Fatalf("%d, expected no error, got %v", i, err) - } -} - -// Benchmarks -var benchResps = []*dynamodb.ListTablesOutput{ - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")}, - {TableNames: []*string{aws.String("TABLE")}}, -} - -var benchDb = func() *dynamodb.DynamoDB { - db := dynamodb.New(unit.Session) - db.Handlers.Send.Clear() // mock sending - db.Handlers.Unmarshal.Clear() - db.Handlers.UnmarshalMeta.Clear() - db.Handlers.ValidateResponse.Clear() - return db -} - -func BenchmarkCodegenIterator(b *testing.B) { - reqNum := 0 - db := benchDb() - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = benchResps[reqNum] - reqNum++ - }) - - input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - iter := func(fn func(*dynamodb.ListTablesOutput, bool) bool) error { - page, _ := db.ListTablesRequest(input) - for ; page != nil; page = page.NextPage() { - page.Send() - out := page.Data.(*dynamodb.ListTablesOutput) - if result := fn(out, !page.HasNextPage()); page.Error != nil || !result { - return page.Error - } - } - return nil - } - - for i := 0; i < b.N; i++ { - reqNum = 0 - iter(func(p *dynamodb.ListTablesOutput, last bool) bool { - return true - }) - } -} - -func BenchmarkEachPageIterator(b *testing.B) { - reqNum := 0 - db := benchDb() - db.Handlers.Unmarshal.PushBack(func(r *request.Request) { - r.Data = benchResps[reqNum] - reqNum++ - }) - - input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)} - for i := 0; i < b.N; i++ { - reqNum = 0 - req, _ := db.ListTablesRequest(input) - req.EachPage(func(p interface{}, last bool) bool { - return true - }) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go deleted file mode 100644 index 4a917248..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package request - -import ( - "bytes" - "net/http" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" -) - -func TestResetBody_WithBodyContents(t *testing.T) { - r := Request{ - HTTPRequest: &http.Request{}, - } - - reader := strings.NewReader("abc") - r.Body = reader - - r.ResetBody() - - if v, ok := r.HTTPRequest.Body.(*offsetReader); !ok || v == nil { - t.Errorf("expected request body to be set to reader, got %#v", - r.HTTPRequest.Body) - } -} - -func TestResetBody_ExcludeUnseekableBodyByMethod(t *testing.T) { - cases := []struct { - Method string - IsNoBody bool - }{ - {"GET", true}, - {"HEAD", true}, - {"DELETE", true}, - {"PUT", false}, - {"PATCH", false}, - {"POST", false}, - } - - reader := aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc"))) - - for i, c := range cases { - r := Request{ - HTTPRequest: &http.Request{}, - Operation: &Operation{ - HTTPMethod: c.Method, - }, - } - - r.SetReaderBody(reader) - - if a, e := r.HTTPRequest.Body == NoBody, c.IsNoBody; a != e { - t.Errorf("%d, expect body to be set to noBody(%t), but was %t", i, e, a) - } - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go deleted file mode 100644 index 4d9258c0..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ /dev/null @@ -1,844 +0,0 @@ -package request_test - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/http/httptest" - "reflect" - "runtime" - "strconv" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "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/signer/v4" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -type testData struct { - Data string -} - -func body(str string) io.ReadCloser { - return ioutil.NopCloser(bytes.NewReader([]byte(str))) -} - -func unmarshal(req *request.Request) { - defer req.HTTPResponse.Body.Close() - if req.Data != nil { - json.NewDecoder(req.HTTPResponse.Body).Decode(req.Data) - } - return -} - -func unmarshalError(req *request.Request) { - bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) - if err != nil { - req.Error = awserr.New("UnmarshaleError", req.HTTPResponse.Status, err) - return - } - if len(bodyBytes) == 0 { - req.Error = awserr.NewRequestFailure( - awserr.New("UnmarshaleError", req.HTTPResponse.Status, fmt.Errorf("empty body")), - req.HTTPResponse.StatusCode, - "", - ) - return - } - var jsonErr jsonErrorResponse - if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { - req.Error = awserr.New("UnmarshaleError", "JSON unmarshal", err) - return - } - req.Error = awserr.NewRequestFailure( - awserr.New(jsonErr.Code, jsonErr.Message, nil), - req.HTTPResponse.StatusCode, - "", - ) -} - -type jsonErrorResponse struct { - Code string `json:"__type"` - Message string `json:"message"` -} - -// test that retries occur for 5xx status codes -func TestRequestRecoverRetry5xx(t *testing.T) { - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 501, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } - if e, a := 2, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - if e, a := "valid", out.Data; e != a { - t.Errorf("expect %q output got %q", e, a) - } -} - -// test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry` -func TestRequestRecoverRetry4xxRetryable(t *testing.T) { - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 400, Body: body(`{"__type":"Throttling","message":"Rate exceeded."}`)}, - {StatusCode: 429, Body: body(`{"__type":"ProvisionedThroughputExceededException","message":"Rate exceeded."}`)}, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } - if e, a := 2, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - if e, a := "valid", out.Data; e != a { - t.Errorf("expect %q output got %q", e, a) - } -} - -// test that retries don't occur for 4xx status codes with a response type that can't be retried -func TestRequest4xxUnretryable(t *testing.T) { - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{StatusCode: 401, Body: body(`{"__type":"SignatureDoesNotMatch","message":"Signature does not match."}`)} - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - if err == nil { - t.Fatalf("expect error, but did not get one") - } - aerr := err.(awserr.RequestFailure) - if e, a := 401, aerr.StatusCode(); e != a { - t.Errorf("expect %d status code, got %d", e, a) - } - if e, a := "SignatureDoesNotMatch", aerr.Code(); e != a { - t.Errorf("expect %q error code, got %q", e, a) - } - if e, a := "Signature does not match.", aerr.Message(); e != a { - t.Errorf("expect %q error message, got %q", e, a) - } - if e, a := 0, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } -} - -func TestRequestExhaustRetries(t *testing.T) { - delays := []time.Duration{} - sleepDelay := func(delay time.Duration) { - delays = append(delays, delay) - } - - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - } - - s := awstesting.NewClient(aws.NewConfig().WithSleepDelay(sleepDelay)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - err := r.Send() - if err == nil { - t.Fatalf("expect error, but did not get one") - } - aerr := err.(awserr.RequestFailure) - if e, a := 500, aerr.StatusCode(); e != a { - t.Errorf("expect %d status code, got %d", e, a) - } - if e, a := "UnknownError", aerr.Code(); e != a { - t.Errorf("expect %q error code, got %q", e, a) - } - if e, a := "An error occurred.", aerr.Message(); e != a { - t.Errorf("expect %q error message, got %q", e, a) - } - if e, a := 3, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - - expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}} - for i, v := range delays { - min := expectDelays[i].min * time.Millisecond - max := expectDelays[i].max * time.Millisecond - if !(min <= v && v <= max) { - t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", - i, v, min, max) - } - } -} - -// test that the request is retried after the credentials are expired. -func TestRequestRecoverExpiredCreds(t *testing.T) { - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 400, Body: body(`{"__type":"ExpiredTokenException","message":"expired token"}`)}, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - - s := awstesting.NewClient(&aws.Config{MaxRetries: aws.Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")}) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - - credExpiredBeforeRetry := false - credExpiredAfterRetry := false - - s.Handlers.AfterRetry.PushBack(func(r *request.Request) { - credExpiredAfterRetry = r.Config.Credentials.IsExpired() - }) - - s.Handlers.Sign.Clear() - s.Handlers.Sign.PushBack(func(r *request.Request) { - r.Config.Credentials.Get() - }) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if credExpiredBeforeRetry { - t.Errorf("Expect valid creds before retry check") - } - if !credExpiredAfterRetry { - t.Errorf("Expect expired creds after retry check") - } - if s.Config.Credentials.IsExpired() { - t.Errorf("Expect valid creds after cred expired recovery") - } - - if e, a := 1, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - if e, a := "valid", out.Data; e != a { - t.Errorf("expect %q output got %q", e, a) - } -} - -func TestMakeAddtoUserAgentHandler(t *testing.T) { - fn := request.MakeAddToUserAgentHandler("name", "version", "extra1", "extra2") - r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}} - r.HTTPRequest.Header.Set("User-Agent", "foo/bar") - fn(r) - - if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a { - t.Errorf("expect %q user agent, got %q", e, a) - } -} - -func TestMakeAddtoUserAgentFreeFormHandler(t *testing.T) { - fn := request.MakeAddToUserAgentFreeFormHandler("name/version (extra1; extra2)") - r := &request.Request{HTTPRequest: &http.Request{Header: http.Header{}}} - r.HTTPRequest.Header.Set("User-Agent", "foo/bar") - fn(r) - - if e, a := "foo/bar name/version (extra1; extra2)", r.HTTPRequest.Header.Get("User-Agent"); e != a { - t.Errorf("expect %q user agent, got %q", e, a) - } -} - -func TestRequestUserAgent(t *testing.T) { - s := awstesting.NewClient(&aws.Config{Region: aws.String("us-east-1")}) - // s.Handlers.Validate.Clear() - - req := s.NewRequest(&request.Operation{Name: "Operation"}, nil, &testData{}) - req.HTTPRequest.Header.Set("User-Agent", "foo/bar") - if err := req.Build(); err != nil { - t.Fatalf("expect no error, got %v", err) - } - - expectUA := fmt.Sprintf("foo/bar %s/%s (%s; %s; %s)", - aws.SDKName, aws.SDKVersion, runtime.Version(), runtime.GOOS, runtime.GOARCH) - if e, a := expectUA, req.HTTPRequest.Header.Get("User-Agent"); e != a { - t.Errorf("expect %q user agent, got %q", e, a) - } -} - -func TestRequestThrottleRetries(t *testing.T) { - delays := []time.Duration{} - sleepDelay := func(delay time.Duration) { - delays = append(delays, delay) - } - - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"Throttling","message":"An error occurred."}`)}, - } - - s := awstesting.NewClient(aws.NewConfig().WithSleepDelay(sleepDelay)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - err := r.Send() - if err == nil { - t.Fatalf("expect error, but did not get one") - } - aerr := err.(awserr.RequestFailure) - if e, a := 500, aerr.StatusCode(); e != a { - t.Errorf("expect %d status code, got %d", e, a) - } - if e, a := "Throttling", aerr.Code(); e != a { - t.Errorf("expect %q error code, got %q", e, a) - } - if e, a := "An error occurred.", aerr.Message(); e != a { - t.Errorf("expect %q error message, got %q", e, a) - } - if e, a := 3, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - - expectDelays := []struct{ min, max time.Duration }{{500, 999}, {1000, 1998}, {2000, 3996}} - for i, v := range delays { - min := expectDelays[i].min * time.Millisecond - max := expectDelays[i].max * time.Millisecond - if !(min <= v && v <= max) { - t.Errorf("Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", - i, v, min, max) - } - } -} - -// test that retries occur for request timeouts when response.Body can be nil -func TestRequestRecoverTimeoutWithNilBody(t *testing.T) { - reqNum := 0 - reqs := []*http.Response{ - {StatusCode: 0, Body: nil}, // body can be nil when requests time out - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - errors := []error{ - errTimeout, nil, - } - - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.AfterRetry.Clear() // force retry on all errors - s.Handlers.AfterRetry.PushBack(func(r *request.Request) { - if r.Error != nil { - r.Error = nil - r.Retryable = aws.Bool(true) - r.RetryCount++ - } - }) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = reqs[reqNum] - r.Error = errors[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } - if e, a := 1, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - if e, a := "valid", out.Data; e != a { - t.Errorf("expect %q output got %q", e, a) - } -} - -func TestRequestRecoverTimeoutWithNilResponse(t *testing.T) { - reqNum := 0 - reqs := []*http.Response{ - nil, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - errors := []error{ - errTimeout, - nil, - } - - s := awstesting.NewClient(aws.NewConfig().WithMaxRetries(10)) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.AfterRetry.Clear() // force retry on all errors - s.Handlers.AfterRetry.PushBack(func(r *request.Request) { - if r.Error != nil { - r.Error = nil - r.Retryable = aws.Bool(true) - r.RetryCount++ - } - }) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = reqs[reqNum] - r.Error = errors[reqNum] - reqNum++ - }) - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } - if e, a := 1, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - if e, a := "valid", out.Data; e != a { - t.Errorf("expect %q output got %q", e, a) - } -} - -func TestRequest_NoBody(t *testing.T) { - cases := []string{ - "GET", "HEAD", "DELETE", - "PUT", "POST", "PATCH", - } - - for i, c := range cases { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if v := r.TransferEncoding; len(v) > 0 { - t.Errorf("%d, expect no body sent with Transfer-Encoding, %v", i, v) - } - - outMsg := []byte(`{"Value": "abc"}`) - - if b, err := ioutil.ReadAll(r.Body); err != nil { - t.Fatalf("%d, expect no error reading request body, got %v", i, err) - } else if n := len(b); n > 0 { - t.Errorf("%d, expect no request body, got %d bytes", i, n) - } - - w.Header().Set("Content-Length", strconv.Itoa(len(outMsg))) - if _, err := w.Write(outMsg); err != nil { - t.Fatalf("%d, expect no error writing server response, got %v", i, err) - } - })) - - s := awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - MaxRetries: aws.Int(0), - Endpoint: aws.String(server.URL), - DisableSSL: aws.Bool(true), - }) - s.Handlers.Build.PushBack(rest.Build) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - - in := struct { - Bucket *string `location:"uri" locationName:"bucket"` - Key *string `location:"uri" locationName:"key"` - }{ - Bucket: aws.String("mybucket"), Key: aws.String("myKey"), - } - - out := struct { - Value *string - }{} - - r := s.NewRequest(&request.Operation{ - Name: "OpName", HTTPMethod: c, HTTPPath: "/{bucket}/{key+}", - }, &in, &out) - - if err := r.Send(); err != nil { - t.Fatalf("%d, expect no error sending request, got %v", i, err) - } - } -} - -func TestIsSerializationErrorRetryable(t *testing.T) { - testCases := []struct { - err error - expected bool - }{ - { - err: awserr.New(request.ErrCodeSerialization, "foo error", nil), - expected: false, - }, - { - err: awserr.New("ErrFoo", "foo error", nil), - expected: false, - }, - { - err: nil, - expected: false, - }, - { - err: awserr.New(request.ErrCodeSerialization, "foo error", stubConnectionResetError), - expected: true, - }, - } - - for i, c := range testCases { - r := &request.Request{ - Error: c.err, - } - if r.IsErrorRetryable() != c.expected { - t.Errorf("Case %d: Expected %v, but received %v", i+1, c.expected, !c.expected) - } - } -} - -func TestWithLogLevel(t *testing.T) { - r := &request.Request{} - - opt := request.WithLogLevel(aws.LogDebugWithHTTPBody) - r.ApplyOptions(opt) - - if !r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) { - t.Errorf("expect log level to be set, but was not, %v", - r.Config.LogLevel.Value()) - } -} - -func TestWithGetResponseHeader(t *testing.T) { - r := &request.Request{} - - var val, val2 string - r.ApplyOptions( - request.WithGetResponseHeader("x-a-header", &val), - request.WithGetResponseHeader("x-second-header", &val2), - ) - - r.HTTPResponse = &http.Response{ - Header: func() http.Header { - h := http.Header{} - h.Set("x-a-header", "first") - h.Set("x-second-header", "second") - return h - }(), - } - r.Handlers.Complete.Run(r) - - if e, a := "first", val; e != a { - t.Errorf("expect %q header value got %q", e, a) - } - if e, a := "second", val2; e != a { - t.Errorf("expect %q header value got %q", e, a) - } -} - -func TestWithGetResponseHeaders(t *testing.T) { - r := &request.Request{} - - var headers http.Header - opt := request.WithGetResponseHeaders(&headers) - - r.ApplyOptions(opt) - - r.HTTPResponse = &http.Response{ - Header: func() http.Header { - h := http.Header{} - h.Set("x-a-header", "headerValue") - return h - }(), - } - r.Handlers.Complete.Run(r) - - if e, a := "headerValue", headers.Get("x-a-header"); e != a { - t.Errorf("expect %q header value got %q", e, a) - } -} - -type connResetCloser struct { -} - -func (rc *connResetCloser) Read(b []byte) (int, error) { - return 0, stubConnectionResetError -} - -func (rc *connResetCloser) Close() error { - return nil -} - -func TestSerializationErrConnectionReset(t *testing.T) { - count := 0 - handlers := request.Handlers{} - handlers.Send.PushBack(func(r *request.Request) { - count++ - r.HTTPResponse = &http.Response{} - r.HTTPResponse.Body = &connResetCloser{} - }) - - handlers.Sign.PushBackNamed(v4.SignRequestHandler) - handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) - - op := &request.Operation{ - Name: "op", - HTTPMethod: "POST", - HTTPPath: "/", - } - - meta := metadata.ClientInfo{ - ServiceName: "fooService", - SigningName: "foo", - SigningRegion: "foo", - Endpoint: "localhost", - APIVersion: "2001-01-01", - JSONVersion: "1.1", - TargetPrefix: "Foo", - } - cfg := unit.Session.Config.Copy() - cfg.MaxRetries = aws.Int(5) - - req := request.New( - *cfg, - meta, - handlers, - client.DefaultRetryer{NumMaxRetries: 5}, - op, - &struct { - }{}, - &struct { - }{}, - ) - - osErr := stubConnectionResetError - req.ApplyOptions(request.WithResponseReadTimeout(time.Second)) - err := req.Send() - if err == nil { - t.Error("Expected rror 'SerializationError', but received nil") - } - if aerr, ok := err.(awserr.Error); ok && aerr.Code() != "SerializationError" { - t.Errorf("Expected 'SerializationError', but received %q", aerr.Code()) - } else if !ok { - t.Errorf("Expected 'awserr.Error', but received %v", reflect.TypeOf(err)) - } else if aerr.OrigErr().Error() != osErr.Error() { - t.Errorf("Expected %q, but received %q", osErr.Error(), aerr.OrigErr().Error()) - } - - if count != 6 { - t.Errorf("Expected '6', but received %d", count) - } -} - -type testRetryer struct { - shouldRetry bool -} - -func (d *testRetryer) MaxRetries() int { - return 3 -} - -// RetryRules returns the delay duration before retrying this request again -func (d *testRetryer) RetryRules(r *request.Request) time.Duration { - return time.Duration(time.Millisecond) -} - -func (d *testRetryer) ShouldRetry(r *request.Request) bool { - d.shouldRetry = true - if r.Retryable != nil { - return *r.Retryable - } - - if r.HTTPResponse.StatusCode >= 500 { - return true - } - return r.IsErrorRetryable() -} - -func TestEnforceShouldRetryCheck(t *testing.T) { - tp := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - ResponseHeaderTimeout: 1 * time.Millisecond, - } - - client := &http.Client{Transport: tp} - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // This server should wait forever. Requests will timeout and the SDK should - // attempt to retry. - select {} - })) - - retryer := &testRetryer{} - s := awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - MaxRetries: aws.Int(0), - Endpoint: aws.String(server.URL), - DisableSSL: aws.Bool(true), - Retryer: retryer, - HTTPClient: client, - EnforceShouldRetryCheck: aws.Bool(true), - }) - - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - - out := &testData{} - r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) - err := r.Send() - if err == nil { - t.Fatalf("expect error, but got nil") - } - if e, a := 3, int(r.RetryCount); e != a { - t.Errorf("expect %d retry count, got %d", e, a) - } - if !retryer.shouldRetry { - t.Errorf("expect 'true' for ShouldRetry, but got %v", retryer.shouldRetry) - } -} - -type errReader struct { - err error -} - -func (reader *errReader) Read(b []byte) (int, error) { - return 0, reader.err -} - -func (reader *errReader) Close() error { - return nil -} - -func TestIsNoBodyReader(t *testing.T) { - cases := []struct { - reader io.ReadCloser - expect bool - }{ - {ioutil.NopCloser(bytes.NewReader([]byte("abc"))), false}, - {ioutil.NopCloser(bytes.NewReader(nil)), false}, - {nil, false}, - {request.NoBody, true}, - } - - for i, c := range cases { - if e, a := c.expect, request.NoBody == c.reader; e != a { - t.Errorf("%d, expect %t match, but was %t", i, e, a) - } - } -} - -func TestRequest_TemporaryRetry(t *testing.T) { - done := make(chan struct{}) - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Length", "1024") - w.WriteHeader(http.StatusOK) - - w.Write(make([]byte, 100)) - - f := w.(http.Flusher) - f.Flush() - - <-done - })) - - client := &http.Client{ - Timeout: 100 * time.Millisecond, - } - - svc := awstesting.NewClient(&aws.Config{ - Region: unit.Session.Config.Region, - MaxRetries: aws.Int(1), - HTTPClient: client, - DisableSSL: aws.Bool(true), - Endpoint: aws.String(server.URL), - }) - - req := svc.NewRequest(&request.Operation{ - Name: "name", HTTPMethod: "GET", HTTPPath: "/path", - }, &struct{}{}, &struct{}{}) - - req.Handlers.Unmarshal.PushBack(func(r *request.Request) { - defer req.HTTPResponse.Body.Close() - _, err := io.Copy(ioutil.Discard, req.HTTPResponse.Body) - r.Error = awserr.New(request.ErrCodeSerialization, "error", err) - }) - - err := req.Send() - if err == nil { - t.Errorf("expect error, got none") - } - close(done) - - aerr := err.(awserr.Error) - if e, a := request.ErrCodeSerialization, aerr.Code(); e != a { - t.Errorf("expect %q error code, got %q", e, a) - } - - if e, a := 1, req.RetryCount; e != a { - t.Errorf("expect %d retries, got %d", e, a) - } - - type temporary interface { - Temporary() bool - } - - terr := aerr.OrigErr().(temporary) - if !terr.Temporary() { - t.Errorf("expect temporary error, was not") - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go deleted file mode 100644 index f35fef21..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ /dev/null @@ -1,161 +0,0 @@ -package request - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// Retryer is an interface to control retry logic for a given service. -// The default implementation used by most services is the client.DefaultRetryer -// structure, which contains basic retry logic using exponential backoff. -type Retryer interface { - RetryRules(*Request) time.Duration - ShouldRetry(*Request) bool - MaxRetries() int -} - -// WithRetryer sets a config Retryer value to the given Config returning it -// for chaining. -func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { - cfg.Retryer = retryer - return cfg -} - -// retryableCodes is a collection of service response codes which are retry-able -// without any further action. -var retryableCodes = map[string]struct{}{ - "RequestError": {}, - "RequestTimeout": {}, - ErrCodeResponseTimeout: {}, - "RequestTimeoutException": {}, // Glacier's flavor of RequestTimeout -} - -var throttleCodes = map[string]struct{}{ - "ProvisionedThroughputExceededException": {}, - "Throttling": {}, - "ThrottlingException": {}, - "RequestLimitExceeded": {}, - "RequestThrottled": {}, - "TooManyRequestsException": {}, // Lambda functions - "PriorRequestNotComplete": {}, // Route53 -} - -// credsExpiredCodes is a collection of error codes which signify the credentials -// need to be refreshed. Expired tokens require refreshing of credentials, and -// resigning before the request can be retried. -var credsExpiredCodes = map[string]struct{}{ - "ExpiredToken": {}, - "ExpiredTokenException": {}, - "RequestExpired": {}, // EC2 Only -} - -func isCodeThrottle(code string) bool { - _, ok := throttleCodes[code] - return ok -} - -func isCodeRetryable(code string) bool { - if _, ok := retryableCodes[code]; ok { - return true - } - - return isCodeExpiredCreds(code) -} - -func isCodeExpiredCreds(code string) bool { - _, ok := credsExpiredCodes[code] - return ok -} - -var validParentCodes = map[string]struct{}{ - ErrCodeSerialization: {}, - ErrCodeRead: {}, -} - -type temporaryError interface { - Temporary() bool -} - -func isNestedErrorRetryable(parentErr awserr.Error) bool { - if parentErr == nil { - return false - } - - if _, ok := validParentCodes[parentErr.Code()]; !ok { - return false - } - - err := parentErr.OrigErr() - if err == nil { - return false - } - - if aerr, ok := err.(awserr.Error); ok { - return isCodeRetryable(aerr.Code()) - } - - if t, ok := err.(temporaryError); ok { - return t.Temporary() - } - - return isErrConnectionReset(err) -} - -// IsErrorRetryable returns whether the error is retryable, based on its Code. -// Returns false if error is nil. -func IsErrorRetryable(err error) bool { - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - return isCodeRetryable(aerr.Code()) || isNestedErrorRetryable(aerr) - } - } - return false -} - -// IsErrorThrottle returns whether the error is to be throttled based on its code. -// Returns false if error is nil. -func IsErrorThrottle(err error) bool { - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - return isCodeThrottle(aerr.Code()) - } - } - return false -} - -// IsErrorExpiredCreds returns whether the error code is a credential expiry error. -// Returns false if error is nil. -func IsErrorExpiredCreds(err error) bool { - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - return isCodeExpiredCreds(aerr.Code()) - } - } - return false -} - -// IsErrorRetryable returns whether the error is retryable, based on its Code. -// Returns false if the request has no Error set. -// -// Alias for the utility function IsErrorRetryable -func (r *Request) IsErrorRetryable() bool { - return IsErrorRetryable(r.Error) -} - -// IsErrorThrottle returns whether the error is to be throttled based on its code. -// Returns false if the request has no Error set -// -// Alias for the utility function IsErrorThrottle -func (r *Request) IsErrorThrottle() bool { - return IsErrorThrottle(r.Error) -} - -// IsErrorExpired returns whether the error code is a credential expiry error. -// Returns false if the request has no Error set. -// -// Alias for the utility function IsErrorExpiredCreds -func (r *Request) IsErrorExpired() bool { - return IsErrorExpiredCreds(r.Error) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go deleted file mode 100644 index a8787487..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package request - -import ( - "errors" - "fmt" - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -func TestRequestThrottling(t *testing.T) { - req := Request{} - - req.Error = awserr.New("Throttling", "", nil) - if e, a := true, req.IsErrorThrottle(); e != a { - t.Errorf("expect %t to be throttled, was %t", e, a) - } -} - -type mockTempError bool - -func (e mockTempError) Error() string { - return fmt.Sprintf("mock temporary error: %t", e.Temporary()) -} -func (e mockTempError) Temporary() bool { - return bool(e) -} - -func TestIsErrorRetryable(t *testing.T) { - cases := []struct { - Err error - IsTemp bool - }{ - { - Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(true)), - IsTemp: true, - }, - { - Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(false)), - IsTemp: false, - }, - { - Err: awserr.New(ErrCodeSerialization, "some error", errors.New("blah")), - IsTemp: false, - }, - { - Err: awserr.New("SomeError", "some error", nil), - IsTemp: false, - }, - { - Err: awserr.New("RequestError", "some error", nil), - IsTemp: true, - }, - } - - for i, c := range cases { - retryable := IsErrorRetryable(c.Err) - if e, a := c.IsTemp, retryable; e != a { - t.Errorf("%d, expect %t temporary error, got %t", i, e, a) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go deleted file mode 100644 index 09a44eb9..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go +++ /dev/null @@ -1,94 +0,0 @@ -package request - -import ( - "io" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -var timeoutErr = awserr.New( - ErrCodeResponseTimeout, - "read on body has reached the timeout limit", - nil, -) - -type readResult struct { - n int - err error -} - -// timeoutReadCloser will handle body reads that take too long. -// We will return a ErrReadTimeout error if a timeout occurs. -type timeoutReadCloser struct { - reader io.ReadCloser - duration time.Duration -} - -// Read will spin off a goroutine to call the reader's Read method. We will -// select on the timer's channel or the read's channel. Whoever completes first -// will be returned. -func (r *timeoutReadCloser) Read(b []byte) (int, error) { - timer := time.NewTimer(r.duration) - c := make(chan readResult, 1) - - go func() { - n, err := r.reader.Read(b) - timer.Stop() - c <- readResult{n: n, err: err} - }() - - select { - case data := <-c: - return data.n, data.err - case <-timer.C: - return 0, timeoutErr - } -} - -func (r *timeoutReadCloser) Close() error { - return r.reader.Close() -} - -const ( - // HandlerResponseTimeout is what we use to signify the name of the - // response timeout handler. - HandlerResponseTimeout = "ResponseTimeoutHandler" -) - -// adaptToResponseTimeoutError is a handler that will replace any top level error -// to a ErrCodeResponseTimeout, if its child is that. -func adaptToResponseTimeoutError(req *Request) { - if err, ok := req.Error.(awserr.Error); ok { - aerr, ok := err.OrigErr().(awserr.Error) - if ok && aerr.Code() == ErrCodeResponseTimeout { - req.Error = aerr - } - } -} - -// WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. -// This will allow for per read timeouts. If a timeout occurred, we will return the -// ErrCodeResponseTimeout. -// -// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) -func WithResponseReadTimeout(duration time.Duration) Option { - return func(r *Request) { - - var timeoutHandler = NamedHandler{ - HandlerResponseTimeout, - func(req *Request) { - req.HTTPResponse.Body = &timeoutReadCloser{ - reader: req.HTTPResponse.Body, - duration: duration, - } - }} - - // remove the handler so we are not stomping over any new durations. - r.Handlers.Send.RemoveByName(HandlerResponseTimeout) - r.Handlers.Send.PushBackNamed(timeoutHandler) - - r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) - r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go deleted file mode 100644 index 33e1b2d1..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_benchmark_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package request_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" -) - -func BenchmarkTimeoutReadCloser(b *testing.B) { - resp := ` - { - "Bar": "qux" - } - ` - - handlers := request.Handlers{} - - handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewBuffer([]byte(resp))), - } - }) - handlers.Sign.PushBackNamed(v4.SignRequestHandler) - handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - op := &request.Operation{ - Name: "op", - HTTPMethod: "POST", - HTTPPath: "/", - } - - meta := metadata.ClientInfo{ - ServiceName: "fooService", - SigningName: "foo", - SigningRegion: "foo", - Endpoint: "localhost", - APIVersion: "2001-01-01", - JSONVersion: "1.1", - TargetPrefix: "Foo", - } - - req := request.New( - *unit.Session.Config, - meta, - handlers, - client.DefaultRetryer{NumMaxRetries: 5}, - op, - &struct { - Foo *string - }{}, - &struct { - Bar *string - }{}, - ) - - req.ApplyOptions(request.WithResponseReadTimeout(15 * time.Second)) - for i := 0; i < b.N; i++ { - err := req.Send() - if err != nil { - b.Errorf("Expected no error, but received %v", err) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go deleted file mode 100644 index c814158d..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package request - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -type testReader struct { - duration time.Duration - count int -} - -func (r *testReader) Read(b []byte) (int, error) { - if r.count > 0 { - r.count-- - return len(b), nil - } - time.Sleep(r.duration) - return 0, io.EOF -} - -func (r *testReader) Close() error { - return nil -} - -func TestTimeoutReadCloser(t *testing.T) { - reader := timeoutReadCloser{ - reader: &testReader{ - duration: time.Second, - count: 5, - }, - duration: time.Millisecond, - } - b := make([]byte, 100) - _, err := reader.Read(b) - if err != nil { - t.Log(err) - } -} - -func TestTimeoutReadCloserSameDuration(t *testing.T) { - reader := timeoutReadCloser{ - reader: &testReader{ - duration: time.Millisecond, - count: 5, - }, - duration: time.Millisecond, - } - b := make([]byte, 100) - _, err := reader.Read(b) - if err != nil { - t.Log(err) - } -} - -func TestWithResponseReadTimeout(t *testing.T) { - r := Request{ - HTTPResponse: &http.Response{ - Body: ioutil.NopCloser(bytes.NewReader(nil)), - }, - } - r.ApplyOptions(WithResponseReadTimeout(time.Second)) - err := r.Send() - if err != nil { - t.Error(err) - } - v, ok := r.HTTPResponse.Body.(*timeoutReadCloser) - if !ok { - t.Error("Expected the body to be a timeoutReadCloser") - } - if v.duration != time.Second { - t.Errorf("Expected %v, but receive %v\n", time.Second, v.duration) - } -} - -func TestAdaptToResponseTimeout(t *testing.T) { - testCases := []struct { - childErr error - r Request - expectedRootCode string - }{ - { - childErr: awserr.New(ErrCodeResponseTimeout, "timeout!", nil), - r: Request{ - Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout, "timeout!", nil)), - }, - expectedRootCode: ErrCodeResponseTimeout, - }, - { - childErr: awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil), - r: Request{ - Error: awserr.New("ErrTest", "FooBar", awserr.New(ErrCodeResponseTimeout+"1", "timeout!", nil)), - }, - expectedRootCode: "ErrTest", - }, - { - r: Request{ - Error: awserr.New("ErrTest", "FooBar", nil), - }, - expectedRootCode: "ErrTest", - }, - } - - for i, c := range testCases { - adaptToResponseTimeoutError(&c.r) - if aerr, ok := c.r.Error.(awserr.Error); !ok { - t.Errorf("Case %d: Expected 'awserr', but received %v", i+1, c.r.Error) - } else if aerr.Code() != c.expectedRootCode { - t.Errorf("Case %d: Expected %q, but received %s", i+1, c.expectedRootCode, aerr.Code()) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go b/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go deleted file mode 100644 index 40124622..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go +++ /dev/null @@ -1,234 +0,0 @@ -package request - -import ( - "bytes" - "fmt" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -const ( - // InvalidParameterErrCode is the error code for invalid parameters errors - InvalidParameterErrCode = "InvalidParameter" - // ParamRequiredErrCode is the error code for required parameter errors - ParamRequiredErrCode = "ParamRequiredError" - // ParamMinValueErrCode is the error code for fields with too low of a - // number value. - ParamMinValueErrCode = "ParamMinValueError" - // ParamMinLenErrCode is the error code for fields without enough elements. - ParamMinLenErrCode = "ParamMinLenError" -) - -// Validator provides a way for types to perform validation logic on their -// input values that external code can use to determine if a type's values -// are valid. -type Validator interface { - Validate() error -} - -// An ErrInvalidParams provides wrapping of invalid parameter errors found when -// validating API operation input parameters. -type ErrInvalidParams struct { - // Context is the base context of the invalid parameter group. - Context string - errs []ErrInvalidParam -} - -// Add adds a new invalid parameter error to the collection of invalid -// parameters. The context of the invalid parameter will be updated to reflect -// this collection. -func (e *ErrInvalidParams) Add(err ErrInvalidParam) { - err.SetContext(e.Context) - e.errs = append(e.errs, err) -} - -// AddNested adds the invalid parameter errors from another ErrInvalidParams -// value into this collection. The nested errors will have their nested context -// updated and base context to reflect the merging. -// -// Use for nested validations errors. -func (e *ErrInvalidParams) AddNested(nestedCtx string, nested ErrInvalidParams) { - for _, err := range nested.errs { - err.SetContext(e.Context) - err.AddNestedContext(nestedCtx) - e.errs = append(e.errs, err) - } -} - -// Len returns the number of invalid parameter errors -func (e ErrInvalidParams) Len() int { - return len(e.errs) -} - -// Code returns the code of the error -func (e ErrInvalidParams) Code() string { - return InvalidParameterErrCode -} - -// Message returns the message of the error -func (e ErrInvalidParams) Message() string { - return fmt.Sprintf("%d validation error(s) found.", len(e.errs)) -} - -// Error returns the string formatted form of the invalid parameters. -func (e ErrInvalidParams) Error() string { - w := &bytes.Buffer{} - fmt.Fprintf(w, "%s: %s\n", e.Code(), e.Message()) - - for _, err := range e.errs { - fmt.Fprintf(w, "- %s\n", err.Message()) - } - - return w.String() -} - -// OrigErr returns the invalid parameters as a awserr.BatchedErrors value -func (e ErrInvalidParams) OrigErr() error { - return awserr.NewBatchError( - InvalidParameterErrCode, e.Message(), e.OrigErrs()) -} - -// OrigErrs returns a slice of the invalid parameters -func (e ErrInvalidParams) OrigErrs() []error { - errs := make([]error, len(e.errs)) - for i := 0; i < len(errs); i++ { - errs[i] = e.errs[i] - } - - return errs -} - -// An ErrInvalidParam represents an invalid parameter error type. -type ErrInvalidParam interface { - awserr.Error - - // Field name the error occurred on. - Field() string - - // SetContext updates the context of the error. - SetContext(string) - - // AddNestedContext updates the error's context to include a nested level. - AddNestedContext(string) -} - -type errInvalidParam struct { - context string - nestedContext string - field string - code string - msg string -} - -// Code returns the error code for the type of invalid parameter. -func (e *errInvalidParam) Code() string { - return e.code -} - -// Message returns the reason the parameter was invalid, and its context. -func (e *errInvalidParam) Message() string { - return fmt.Sprintf("%s, %s.", e.msg, e.Field()) -} - -// Error returns the string version of the invalid parameter error. -func (e *errInvalidParam) Error() string { - return fmt.Sprintf("%s: %s", e.code, e.Message()) -} - -// OrigErr returns nil, Implemented for awserr.Error interface. -func (e *errInvalidParam) OrigErr() error { - return nil -} - -// Field Returns the field and context the error occurred. -func (e *errInvalidParam) Field() string { - field := e.context - if len(field) > 0 { - field += "." - } - if len(e.nestedContext) > 0 { - field += fmt.Sprintf("%s.", e.nestedContext) - } - field += e.field - - return field -} - -// SetContext updates the base context of the error. -func (e *errInvalidParam) SetContext(ctx string) { - e.context = ctx -} - -// AddNestedContext prepends a context to the field's path. -func (e *errInvalidParam) AddNestedContext(ctx string) { - if len(e.nestedContext) == 0 { - e.nestedContext = ctx - } else { - e.nestedContext = fmt.Sprintf("%s.%s", ctx, e.nestedContext) - } - -} - -// An ErrParamRequired represents an required parameter error. -type ErrParamRequired struct { - errInvalidParam -} - -// NewErrParamRequired creates a new required parameter error. -func NewErrParamRequired(field string) *ErrParamRequired { - return &ErrParamRequired{ - errInvalidParam{ - code: ParamRequiredErrCode, - field: field, - msg: fmt.Sprintf("missing required field"), - }, - } -} - -// An ErrParamMinValue represents a minimum value parameter error. -type ErrParamMinValue struct { - errInvalidParam - min float64 -} - -// NewErrParamMinValue creates a new minimum value parameter error. -func NewErrParamMinValue(field string, min float64) *ErrParamMinValue { - return &ErrParamMinValue{ - errInvalidParam: errInvalidParam{ - code: ParamMinValueErrCode, - field: field, - msg: fmt.Sprintf("minimum field value of %v", min), - }, - min: min, - } -} - -// MinValue returns the field's require minimum value. -// -// float64 is returned for both int and float min values. -func (e *ErrParamMinValue) MinValue() float64 { - return e.min -} - -// An ErrParamMinLen represents a minimum length parameter error. -type ErrParamMinLen struct { - errInvalidParam - min int -} - -// NewErrParamMinLen creates a new minimum length parameter error. -func NewErrParamMinLen(field string, min int) *ErrParamMinLen { - return &ErrParamMinLen{ - errInvalidParam: errInvalidParam{ - code: ParamMinLenErrCode, - field: field, - msg: fmt.Sprintf("minimum field size of %v", min), - }, - min: min, - } -} - -// MinLen returns the field's required minimum length. -func (e *ErrParamMinLen) MinLen() int { - return e.min -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go deleted file mode 100644 index 4601f883..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go +++ /dev/null @@ -1,295 +0,0 @@ -package request - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -// WaiterResourceNotReadyErrorCode is the error code returned by a waiter when -// the waiter's max attempts have been exhausted. -const WaiterResourceNotReadyErrorCode = "ResourceNotReady" - -// A WaiterOption is a function that will update the Waiter value's fields to -// configure the waiter. -type WaiterOption func(*Waiter) - -// WithWaiterMaxAttempts returns the maximum number of times the waiter should -// attempt to check the resource for the target state. -func WithWaiterMaxAttempts(max int) WaiterOption { - return func(w *Waiter) { - w.MaxAttempts = max - } -} - -// WaiterDelay will return a delay the waiter should pause between attempts to -// check the resource state. The passed in attempt is the number of times the -// Waiter has checked the resource state. -// -// Attempt is the number of attempts the Waiter has made checking the resource -// state. -type WaiterDelay func(attempt int) time.Duration - -// ConstantWaiterDelay returns a WaiterDelay that will always return a constant -// delay the waiter should use between attempts. It ignores the number of -// attempts made. -func ConstantWaiterDelay(delay time.Duration) WaiterDelay { - return func(attempt int) time.Duration { - return delay - } -} - -// WithWaiterDelay will set the Waiter to use the WaiterDelay passed in. -func WithWaiterDelay(delayer WaiterDelay) WaiterOption { - return func(w *Waiter) { - w.Delay = delayer - } -} - -// WithWaiterLogger returns a waiter option to set the logger a waiter -// should use to log warnings and errors to. -func WithWaiterLogger(logger aws.Logger) WaiterOption { - return func(w *Waiter) { - w.Logger = logger - } -} - -// WithWaiterRequestOptions returns a waiter option setting the request -// options for each request the waiter makes. Appends to waiter's request -// options already set. -func WithWaiterRequestOptions(opts ...Option) WaiterOption { - return func(w *Waiter) { - w.RequestOptions = append(w.RequestOptions, opts...) - } -} - -// A Waiter provides the functionality to perform a blocking call which will -// wait for a resource state to be satisfied by a service. -// -// This type should not be used directly. The API operations provided in the -// service packages prefixed with "WaitUntil" should be used instead. -type Waiter struct { - Name string - Acceptors []WaiterAcceptor - Logger aws.Logger - - MaxAttempts int - Delay WaiterDelay - - RequestOptions []Option - NewRequest func([]Option) (*Request, error) - SleepWithContext func(aws.Context, time.Duration) error -} - -// ApplyOptions updates the waiter with the list of waiter options provided. -func (w *Waiter) ApplyOptions(opts ...WaiterOption) { - for _, fn := range opts { - fn(w) - } -} - -// WaiterState are states the waiter uses based on WaiterAcceptor definitions -// to identify if the resource state the waiter is waiting on has occurred. -type WaiterState int - -// String returns the string representation of the waiter state. -func (s WaiterState) String() string { - switch s { - case SuccessWaiterState: - return "success" - case FailureWaiterState: - return "failure" - case RetryWaiterState: - return "retry" - default: - return "unknown waiter state" - } -} - -// States the waiter acceptors will use to identify target resource states. -const ( - SuccessWaiterState WaiterState = iota // waiter successful - FailureWaiterState // waiter failed - RetryWaiterState // waiter needs to be retried -) - -// WaiterMatchMode is the mode that the waiter will use to match the WaiterAcceptor -// definition's Expected attribute. -type WaiterMatchMode int - -// Modes the waiter will use when inspecting API response to identify target -// resource states. -const ( - PathAllWaiterMatch WaiterMatchMode = iota // match on all paths - PathWaiterMatch // match on specific path - PathAnyWaiterMatch // match on any path - PathListWaiterMatch // match on list of paths - StatusWaiterMatch // match on status code - ErrorWaiterMatch // match on error -) - -// String returns the string representation of the waiter match mode. -func (m WaiterMatchMode) String() string { - switch m { - case PathAllWaiterMatch: - return "pathAll" - case PathWaiterMatch: - return "path" - case PathAnyWaiterMatch: - return "pathAny" - case PathListWaiterMatch: - return "pathList" - case StatusWaiterMatch: - return "status" - case ErrorWaiterMatch: - return "error" - default: - return "unknown waiter match mode" - } -} - -// WaitWithContext will make requests for the API operation using NewRequest to -// build API requests. The request's response will be compared against the -// Waiter's Acceptors to determine the successful state of the resource the -// waiter is inspecting. -// -// The passed in context must not be nil. If it is nil a panic will occur. The -// Context will be used to cancel the waiter's pending requests and retry delays. -// Use aws.BackgroundContext if no context is available. -// -// The waiter will continue until the target state defined by the Acceptors, -// or the max attempts expires. -// -// Will return the WaiterResourceNotReadyErrorCode error code if the waiter's -// retryer ShouldRetry returns false. This normally will happen when the max -// wait attempts expires. -func (w Waiter) WaitWithContext(ctx aws.Context) error { - - for attempt := 1; ; attempt++ { - req, err := w.NewRequest(w.RequestOptions) - if err != nil { - waiterLogf(w.Logger, "unable to create request %v", err) - return err - } - req.Handlers.Build.PushBack(MakeAddToUserAgentFreeFormHandler("Waiter")) - err = req.Send() - - // See if any of the acceptors match the request's response, or error - for _, a := range w.Acceptors { - if matched, matchErr := a.match(w.Name, w.Logger, req, err); matched { - return matchErr - } - } - - // The Waiter should only check the resource state MaxAttempts times - // This is here instead of in the for loop above to prevent delaying - // unnecessary when the waiter will not retry. - if attempt == w.MaxAttempts { - break - } - - // Delay to wait before inspecting the resource again - delay := w.Delay(attempt) - if sleepFn := req.Config.SleepDelay; sleepFn != nil { - // Support SleepDelay for backwards compatibility and testing - sleepFn(delay) - } else { - sleepCtxFn := w.SleepWithContext - if sleepCtxFn == nil { - sleepCtxFn = aws.SleepWithContext - } - - if err := sleepCtxFn(ctx, delay); err != nil { - return awserr.New(CanceledErrorCode, "waiter context canceled", err) - } - } - } - - return awserr.New(WaiterResourceNotReadyErrorCode, "exceeded wait attempts", nil) -} - -// A WaiterAcceptor provides the information needed to wait for an API operation -// to complete. -type WaiterAcceptor struct { - State WaiterState - Matcher WaiterMatchMode - Argument string - Expected interface{} -} - -// match returns if the acceptor found a match with the passed in request -// or error. True is returned if the acceptor made a match, error is returned -// if there was an error attempting to perform the match. -func (a *WaiterAcceptor) match(name string, l aws.Logger, req *Request, err error) (bool, error) { - result := false - var vals []interface{} - - switch a.Matcher { - case PathAllWaiterMatch, PathWaiterMatch: - // Require all matches to be equal for result to match - vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) - if len(vals) == 0 { - break - } - result = true - for _, val := range vals { - if !awsutil.DeepEqual(val, a.Expected) { - result = false - break - } - } - case PathAnyWaiterMatch: - // Only a single match needs to equal for the result to match - vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) - for _, val := range vals { - if awsutil.DeepEqual(val, a.Expected) { - result = true - break - } - } - case PathListWaiterMatch: - // ignored matcher - case StatusWaiterMatch: - s := a.Expected.(int) - result = s == req.HTTPResponse.StatusCode - case ErrorWaiterMatch: - if aerr, ok := err.(awserr.Error); ok { - result = aerr.Code() == a.Expected.(string) - } - default: - waiterLogf(l, "WARNING: Waiter %s encountered unexpected matcher: %s", - name, a.Matcher) - } - - if !result { - // If there was no matching result found there is nothing more to do - // for this response, retry the request. - return false, nil - } - - switch a.State { - case SuccessWaiterState: - // waiter completed - return true, nil - case FailureWaiterState: - // Waiter failure state triggered - return true, awserr.New(WaiterResourceNotReadyErrorCode, - "failed waiting for successful resource state", err) - case RetryWaiterState: - // clear the error and retry the operation - return false, nil - default: - waiterLogf(l, "WARNING: Waiter %s encountered unexpected state: %s", - name, a.State) - return false, nil - } -} - -func waiterLogf(logger aws.Logger, msg string, args ...interface{}) { - if logger != nil { - logger.Log(fmt.Sprintf(msg, args...)) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go deleted file mode 100644 index db0f92df..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter_test.go +++ /dev/null @@ -1,654 +0,0 @@ -package request_test - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -type mockClient struct { - *client.Client -} -type MockInput struct{} -type MockOutput struct { - States []*MockState -} -type MockState struct { - State *string -} - -func (c *mockClient) MockRequest(input *MockInput) (*request.Request, *MockOutput) { - op := &request.Operation{ - Name: "Mock", - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &MockInput{} - } - - output := &MockOutput{} - req := c.NewRequest(op, input, output) - req.Data = output - return req, output -} - -func BuildNewMockRequest(c *mockClient, in *MockInput) func([]request.Option) (*request.Request, error) { - return func(opts []request.Option) (*request.Request, error) { - req, _ := c.MockRequest(in) - req.ApplyOptions(opts...) - return req, nil - } -} - -func TestWaiterPathAll(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 2 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("pending")}, - }, - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("running")}, - }, - }, - } - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - - w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, - Argument: "States[].State", - Expected: "running", - }, - }, - NewRequest: BuildNewMockRequest(svc, &MockInput{}), - } - - err := w.WaitWithContext(aws.BackgroundContext()) - assert.NoError(t, err) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) -} - -func TestWaiterPath(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 2 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("pending")}, - }, - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("running")}, - }, - }, - } - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - - w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathWaiterMatch, - Argument: "States[].State", - Expected: "running", - }, - }, - NewRequest: BuildNewMockRequest(svc, &MockInput{}), - } - - err := w.WaitWithContext(aws.BackgroundContext()) - assert.NoError(t, err) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) -} - -func TestWaiterFailure(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 2 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("pending")}, - }, - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("stopping")}, - }, - }, - } - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - - w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, - Argument: "States[].State", - Expected: "running", - }, - { - State: request.FailureWaiterState, - Matcher: request.PathAnyWaiterMatch, - Argument: "States[].State", - Expected: "stopping", - }, - }, - NewRequest: BuildNewMockRequest(svc, &MockInput{}), - } - - err := w.WaitWithContext(aws.BackgroundContext()).(awserr.Error) - assert.Error(t, err) - assert.Equal(t, request.WaiterResourceNotReadyErrorCode, err.Code()) - assert.Equal(t, "failed waiting for successful resource state", err.Message()) - assert.Equal(t, 3, numBuiltReq) - assert.Equal(t, 3, reqNum) -} - -func TestWaiterError(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.UnmarshalError.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - resps := []*MockOutput{ - { // Request 1 - States: []*MockState{ - {State: aws.String("pending")}, - {State: aws.String("pending")}, - }, - }, - { // Request 1, error case retry - }, - { // Request 2, error case failure - }, - { // Request 3 - States: []*MockState{ - {State: aws.String("running")}, - {State: aws.String("running")}, - }, - }, - } - reqErrs := make([]error, len(resps)) - reqErrs[1] = awserr.New("MockException", "mock exception message", nil) - reqErrs[2] = awserr.New("FailureException", "mock failure exception message", nil) - - numBuiltReq := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - numBuiltReq++ - }) - svc.Handlers.Send.PushBack(func(r *request.Request) { - code := 200 - if reqNum == 1 { - code = 400 - } - r.HTTPResponse = &http.Response{ - StatusCode: code, - Status: http.StatusText(code), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - }) - svc.Handlers.Unmarshal.PushBack(func(r *request.Request) { - if reqNum >= len(resps) { - assert.Fail(t, "too many polling requests made") - return - } - r.Data = resps[reqNum] - reqNum++ - }) - svc.Handlers.UnmarshalMeta.PushBack(func(r *request.Request) { - // If there was an error unmarshal error will be called instead of unmarshal - // need to increment count here also - if err := reqErrs[reqNum]; err != nil { - r.Error = err - reqNum++ - } - }) - - w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, - Argument: "States[].State", - Expected: "running", - }, - { - State: request.RetryWaiterState, - Matcher: request.ErrorWaiterMatch, - Argument: "", - Expected: "MockException", - }, - { - State: request.FailureWaiterState, - Matcher: request.ErrorWaiterMatch, - Argument: "", - Expected: "FailureException", - }, - }, - NewRequest: BuildNewMockRequest(svc, &MockInput{}), - } - - err := w.WaitWithContext(aws.BackgroundContext()) - if err == nil { - t.Fatalf("expected error, but did not get one") - } - aerr := err.(awserr.Error) - if e, a := request.WaiterResourceNotReadyErrorCode, aerr.Code(); e != a { - t.Errorf("expect %q error code, got %q", e, a) - } - if e, a := 3, numBuiltReq; e != a { - t.Errorf("expect %d built requests got %d", e, a) - } - if e, a := 3, reqNum; e != a { - t.Errorf("expect %d reqNum got %d", e, a) - } -} - -func TestWaiterStatus(t *testing.T) { - svc := &mockClient{Client: awstesting.NewClient(&aws.Config{ - Region: aws.String("mock-region"), - })} - svc.Handlers.Send.Clear() // mock sending - svc.Handlers.Unmarshal.Clear() - svc.Handlers.UnmarshalMeta.Clear() - svc.Handlers.ValidateResponse.Clear() - - reqNum := 0 - svc.Handlers.Build.PushBack(func(r *request.Request) { - reqNum++ - }) - svc.Handlers.Send.PushBack(func(r *request.Request) { - code := 200 - if reqNum == 3 { - code = 404 - r.Error = awserr.New("NotFound", "Not Found", nil) - } - r.HTTPResponse = &http.Response{ - StatusCode: code, - Status: http.StatusText(code), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - }) - - w := request.Waiter{ - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(0), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Argument: "", - Expected: 404, - }, - }, - NewRequest: BuildNewMockRequest(svc, &MockInput{}), - } - - err := w.WaitWithContext(aws.BackgroundContext()) - assert.NoError(t, err) - assert.Equal(t, 3, reqNum) -} - -func TestWaiter_ApplyOptions(t *testing.T) { - w := request.Waiter{} - - logger := aws.NewDefaultLogger() - - w.ApplyOptions( - request.WithWaiterLogger(logger), - request.WithWaiterRequestOptions(request.WithLogLevel(aws.LogDebug)), - request.WithWaiterMaxAttempts(2), - request.WithWaiterDelay(request.ConstantWaiterDelay(5*time.Second)), - ) - - if e, a := logger, w.Logger; e != a { - t.Errorf("expect logger to be set, and match, was not, %v, %v", e, a) - } - - if len(w.RequestOptions) != 1 { - t.Fatalf("expect request options to be set to only a single option, %v", w.RequestOptions) - } - r := request.Request{} - r.ApplyOptions(w.RequestOptions...) - if e, a := aws.LogDebug, r.Config.LogLevel.Value(); e != a { - t.Errorf("expect %v loglevel got %v", e, a) - } - - if e, a := 2, w.MaxAttempts; e != a { - t.Errorf("expect %d retryer max attempts, got %d", e, a) - } - if e, a := 5*time.Second, w.Delay(0); e != a { - t.Errorf("expect %d retryer delay, got %d", e, a) - } -} - -func TestWaiter_WithContextCanceled(t *testing.T) { - c := awstesting.NewClient() - - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - reqCount := 0 - - w := request.Waiter{ - Name: "TestWaiter", - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(1 * time.Millisecond), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - }, - Logger: aws.NewDefaultLogger(), - NewRequest: func(opts []request.Option) (*request.Request, error) { - req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - req.HTTPResponse = &http.Response{StatusCode: http.StatusNotFound} - req.Handlers.Clear() - req.Data = struct{}{} - req.Handlers.Send.PushBack(func(r *request.Request) { - if reqCount == 1 { - ctx.Error = fmt.Errorf("context canceled") - close(ctx.DoneCh) - } - reqCount++ - }) - - return req, nil - }, - } - - w.SleepWithContext = func(c aws.Context, delay time.Duration) error { - context := c.(*awstesting.FakeContext) - select { - case <-context.DoneCh: - return context.Err() - default: - return nil - } - } - - err := w.WaitWithContext(ctx) - - if err == nil { - t.Fatalf("expect waiter to be canceled.") - } - aerr := err.(awserr.Error) - if e, a := request.CanceledErrorCode, aerr.Code(); e != a { - t.Errorf("expect %q error code, got %q", e, a) - } - if e, a := 2, reqCount; e != a { - t.Errorf("expect %d requests, got %d", e, a) - } -} - -func TestWaiter_WithContext(t *testing.T) { - c := awstesting.NewClient() - - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - reqCount := 0 - - statuses := []int{http.StatusNotFound, http.StatusOK} - - w := request.Waiter{ - Name: "TestWaiter", - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(1 * time.Millisecond), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - }, - Logger: aws.NewDefaultLogger(), - NewRequest: func(opts []request.Option) (*request.Request, error) { - req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - req.HTTPResponse = &http.Response{StatusCode: statuses[reqCount]} - req.Handlers.Clear() - req.Data = struct{}{} - req.Handlers.Send.PushBack(func(r *request.Request) { - if reqCount == 1 { - ctx.Error = fmt.Errorf("context canceled") - close(ctx.DoneCh) - } - reqCount++ - }) - - return req, nil - }, - } - - err := w.WaitWithContext(ctx) - - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if e, a := 2, reqCount; e != a { - t.Errorf("expect %d requests, got %d", e, a) - } -} - -func TestWaiter_AttemptsExpires(t *testing.T) { - c := awstesting.NewClient() - - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - reqCount := 0 - - w := request.Waiter{ - Name: "TestWaiter", - MaxAttempts: 2, - Delay: request.ConstantWaiterDelay(1 * time.Millisecond), - SleepWithContext: aws.SleepWithContext, - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - }, - Logger: aws.NewDefaultLogger(), - NewRequest: func(opts []request.Option) (*request.Request, error) { - req := c.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) - req.HTTPResponse = &http.Response{StatusCode: http.StatusNotFound} - req.Handlers.Clear() - req.Data = struct{}{} - req.Handlers.Send.PushBack(func(r *request.Request) { - reqCount++ - }) - - return req, nil - }, - } - - err := w.WaitWithContext(ctx) - - if err == nil { - t.Fatalf("expect error did not get one") - } - aerr := err.(awserr.Error) - if e, a := request.WaiterResourceNotReadyErrorCode, aerr.Code(); e != a { - t.Errorf("expect %q error code, got %q", e, a) - } - if e, a := 2, reqCount; e != a { - t.Errorf("expect %d requests, got %d", e, a) - } -} - -func TestWaiterNilInput(t *testing.T) { - // Code generation doesn't have a great way to verify the code is correct - // other than being run via unit tests in the SDK. This should be fixed - // So code generation can be validated independently. - - client := s3.New(unit.Session) - client.Handlers.Validate.Clear() - client.Handlers.Send.Clear() // mock sending - client.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: http.StatusOK, - } - }) - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - client.Config.SleepDelay = func(dur time.Duration) {} - - // Ensure waiters do not panic on nil input. It doesn't make sense to - // call a waiter without an input, Validation will - err := client.WaitUntilBucketExists(nil) - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } -} - -func TestWaiterWithContextNilInput(t *testing.T) { - // Code generation doesn't have a great way to verify the code is correct - // other than being run via unit tests in the SDK. This should be fixed - // So code generation can be validated independently. - - client := s3.New(unit.Session) - client.Handlers.Validate.Clear() - client.Handlers.Send.Clear() // mock sending - client.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: http.StatusOK, - } - }) - client.Handlers.Unmarshal.Clear() - client.Handlers.UnmarshalMeta.Clear() - client.Handlers.ValidateResponse.Clear() - - // Ensure waiters do not panic on nil input - ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} - err := client.WaitUntilBucketExistsWithContext(ctx, nil, - request.WithWaiterDelay(request.ConstantWaiterDelay(0)), - request.WithWaiterMaxAttempts(1), - ) - if err != nil { - t.Fatalf("expect no error, but got %v", err) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go deleted file mode 100644 index a89c0af5..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go +++ /dev/null @@ -1,243 +0,0 @@ -package session - -import ( - "bytes" - "fmt" - "net" - "net/http" - "os" - "strings" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/awstesting" -) - -var TLSBundleCertFile string -var TLSBundleKeyFile string -var TLSBundleCAFile string - -func TestMain(m *testing.M) { - var err error - - TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err = awstesting.CreateTLSBundleFiles() - if err != nil { - panic(err) - } - - fmt.Println("TestMain", TLSBundleCertFile, TLSBundleKeyFile) - - code := m.Run() - - err = awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile) - if err != nil { - panic(err) - } - - os.Exit(code) -} - -func TestNewSession_WithCustomCABundle_Env(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - os.Setenv("AWS_CA_BUNDLE", TLSBundleCAFile) - - s, err := NewSession(&aws.Config{ - HTTPClient: &http.Client{}, - Endpoint: aws.String(endpoint), - Region: aws.String("mock-region"), - Credentials: credentials.AnonymousCredentials, - }) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if s == nil { - t.Fatalf("expect session to be created, got none") - } - - req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) - resp, err := s.Config.HTTPClient.Do(req) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if e, a := http.StatusOK, resp.StatusCode; e != a { - t.Errorf("expect %d status code, got %d", e, a) - } -} - -func TestNewSession_WithCustomCABundle_EnvNotExists(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_CA_BUNDLE", "file-not-exists") - - s, err := NewSession() - if err == nil { - t.Fatalf("expect error, got none") - } - if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a { - t.Errorf("expect %s error code, got %s", e, a) - } - if s != nil { - t.Errorf("expect nil session, got %v", s) - } -} - -func TestNewSession_WithCustomCABundle_Option(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - s, err := NewSessionWithOptions(Options{ - Config: aws.Config{ - HTTPClient: &http.Client{}, - Endpoint: aws.String(endpoint), - Region: aws.String("mock-region"), - Credentials: credentials.AnonymousCredentials, - }, - CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), - }) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if s == nil { - t.Fatalf("expect session to be created, got none") - } - - req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) - resp, err := s.Config.HTTPClient.Do(req) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if e, a := http.StatusOK, resp.StatusCode; e != a { - t.Errorf("expect %d status code, got %d", e, a) - } -} - -func TestNewSession_WithCustomCABundle_OptionPriority(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - os.Setenv("AWS_CA_BUNDLE", "file-not-exists") - - s, err := NewSessionWithOptions(Options{ - Config: aws.Config{ - HTTPClient: &http.Client{}, - Endpoint: aws.String(endpoint), - Region: aws.String("mock-region"), - Credentials: credentials.AnonymousCredentials, - }, - CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), - }) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if s == nil { - t.Fatalf("expect session to be created, got none") - } - - req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) - resp, err := s.Config.HTTPClient.Do(req) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if e, a := http.StatusOK, resp.StatusCode; e != a { - t.Errorf("expect %d status code, got %d", e, a) - } -} - -type mockRoundTripper struct{} - -func (m *mockRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { - return nil, nil -} - -func TestNewSession_WithCustomCABundle_UnsupportedTransport(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - s, err := NewSessionWithOptions(Options{ - Config: aws.Config{ - HTTPClient: &http.Client{ - Transport: &mockRoundTripper{}, - }, - }, - CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), - }) - if err == nil { - t.Fatalf("expect error, got none") - } - if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a { - t.Errorf("expect %s error code, got %s", e, a) - } - if s != nil { - t.Errorf("expect nil session, got %v", s) - } - aerrMsg := err.(awserr.Error).Message() - if e, a := "transport unsupported type", aerrMsg; !strings.Contains(a, e) { - t.Errorf("expect %s to be in %s", e, a) - } -} - -func TestNewSession_WithCustomCABundle_TransportSet(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - s, err := NewSessionWithOptions(Options{ - Config: aws.Config{ - Endpoint: aws.String(endpoint), - Region: aws.String("mock-region"), - Credentials: credentials.AnonymousCredentials, - HTTPClient: &http.Client{ - Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).Dial, - TLSHandshakeTimeout: 2 * time.Second, - }, - }, - }, - CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), - }) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if s == nil { - t.Fatalf("expect session to be created, got none") - } - - req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) - resp, err := s.Config.HTTPClient.Do(req) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - if e, a := http.StatusOK, resp.StatusCode; e != a { - t.Errorf("expect %d status code, got %d", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go deleted file mode 100644 index ea7b886f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ /dev/null @@ -1,273 +0,0 @@ -/* -Package session provides configuration for the SDK's service clients. - -Sessions can be shared across all service clients that share the same base -configuration. The Session is built from the SDK's default configuration and -request handlers. - -Sessions should be cached when possible, because creating a new Session will -load all configuration values from the environment, and config files each time -the Session is created. Sharing the Session value across all of your service -clients will ensure the configuration is loaded the fewest number of times possible. - -Concurrency - -Sessions are safe to use concurrently as long as the Session is not being -modified. The SDK will not modify the Session once the Session has been created. -Creating service clients concurrently from a shared Session is safe. - -Sessions from Shared Config - -Sessions can be created using the method above that will only load the -additional config if the AWS_SDK_LOAD_CONFIG environment variable is set. -Alternatively you can explicitly create a Session with shared config enabled. -To do this you can use NewSessionWithOptions to configure how the Session will -be created. Using the NewSessionWithOptions with SharedConfigState set to -SharedConfigEnable will create the session as if the AWS_SDK_LOAD_CONFIG -environment variable was set. - -Creating Sessions - -When creating Sessions optional aws.Config values can be passed in that will -override the default, or loaded config values the Session is being created -with. This allows you to provide additional, or case based, configuration -as needed. - -By default NewSession will only load credentials from the shared credentials -file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is -set to a truthy value the Session will be created from the configuration -values from the shared config (~/.aws/config) and shared credentials -(~/.aws/credentials) files. See the section Sessions from Shared Config for -more information. - -Create a Session with the default config and request handlers. With credentials -region, and profile loaded from the environment and shared config automatically. -Requires the AWS_PROFILE to be set, or "default" is used. - - // Create Session - sess := session.Must(session.NewSession()) - - // Create a Session with a custom region - sess := session.Must(session.NewSession(&aws.Config{ - Region: aws.String("us-east-1"), - })) - - // Create a S3 client instance from a session - sess := session.Must(session.NewSession()) - - svc := s3.New(sess) - -Create Session With Option Overrides - -In addition to NewSession, Sessions can be created using NewSessionWithOptions. -This func allows you to control and override how the Session will be created -through code instead of being driven by environment variables only. - -Use NewSessionWithOptions when you want to provide the config profile, or -override the shared config state (AWS_SDK_LOAD_CONFIG). - - // Equivalent to session.NewSession() - sess := session.Must(session.NewSessionWithOptions(session.Options{ - // Options - })) - - // Specify profile to load for the session's config - sess := session.Must(session.NewSessionWithOptions(session.Options{ - Profile: "profile_name", - })) - - // Specify profile for config and region for requests - sess := session.Must(session.NewSessionWithOptions(session.Options{ - Config: aws.Config{Region: aws.String("us-east-1")}, - Profile: "profile_name", - })) - - // Force enable Shared Config support - sess := session.Must(session.NewSessionWithOptions(session.Options{ - SharedConfigState: session.SharedConfigEnable, - })) - -Adding Handlers - -You can add handlers to a session for processing HTTP requests. All service -clients that use the session inherit the handlers. For example, the following -handler logs every request and its payload made by a service client: - - // Create a session, and add additional handlers for all service - // clients created with the Session to inherit. Adds logging handler. - sess := session.Must(session.NewSession()) - - sess.Handlers.Send.PushFront(func(r *request.Request) { - // Log every request made and its payload - logger.Println("Request: %s/%s, Payload: %s", - r.ClientInfo.ServiceName, r.Operation, r.Params) - }) - -Deprecated "New" function - -The New session function has been deprecated because it does not provide good -way to return errors that occur when loading the configuration files and values. -Because of this, NewSession was created so errors can be retrieved when -creating a session fails. - -Shared Config Fields - -By default the SDK will only load the shared credentials file's (~/.aws/credentials) -credentials values, and all other config is provided by the environment variables, -SDK defaults, and user provided aws.Config values. - -If the AWS_SDK_LOAD_CONFIG environment variable is set, or SharedConfigEnable -option is used to create the Session the full shared config values will be -loaded. This includes credentials, region, and support for assume role. In -addition the Session will load its configuration from both the shared config -file (~/.aws/config) and shared credentials file (~/.aws/credentials). Both -files have the same format. - -If both config files are present the configuration from both files will be -read. The Session will be created from configuration values from the shared -credentials file (~/.aws/credentials) over those in the shared config file (~/.aws/config). - -Credentials are the values the SDK should use for authenticating requests with -AWS Services. They arfrom a configuration file will need to include both -aws_access_key_id and aws_secret_access_key must be provided together in the -same file to be considered valid. The values will be ignored if not a complete -group. aws_session_token is an optional field that can be provided if both of -the other two fields are also provided. - - aws_access_key_id = AKID - aws_secret_access_key = SECRET - aws_session_token = TOKEN - -Assume Role values allow you to configure the SDK to assume an IAM role using -a set of credentials provided in a config file via the source_profile field. -Both "role_arn" and "source_profile" are required. The SDK supports assuming -a role with MFA token if the session option AssumeRoleTokenProvider -is set. - - role_arn = arn:aws:iam:::role/ - source_profile = profile_with_creds - external_id = 1234 - mfa_serial = - role_session_name = session_name - -Region is the region the SDK should use for looking up AWS service endpoints -and signing requests. - - region = us-east-1 - -Assume Role with MFA token - -To create a session with support for assuming an IAM role with MFA set the -session option AssumeRoleTokenProvider to a function that will prompt for the -MFA token code when the SDK assumes the role and refreshes the role's credentials. -This allows you to configure the SDK via the shared config to assumea role -with MFA tokens. - -In order for the SDK to assume a role with MFA the SharedConfigState -session option must be set to SharedConfigEnable, or AWS_SDK_LOAD_CONFIG -environment variable set. - -The shared configuration instructs the SDK to assume an IAM role with MFA -when the mfa_serial configuration field is set in the shared config -(~/.aws/config) or shared credentials (~/.aws/credentials) file. - -If mfa_serial is set in the configuration, the SDK will assume the role, and -the AssumeRoleTokenProvider session option is not set an an error will -be returned when creating the session. - - sess := session.Must(session.NewSessionWithOptions(session.Options{ - AssumeRoleTokenProvider: stscreds.StdinTokenProvider, - })) - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess) - -To setup assume role outside of a session see the stscrds.AssumeRoleProvider -documentation. - -Environment Variables - -When a Session is created several environment variables can be set to adjust -how the SDK functions, and what configuration data it loads when creating -Sessions. All environment values are optional, but some values like credentials -require multiple of the values to set or the partial values will be ignored. -All environment variable values are strings unless otherwise noted. - -Environment configuration values. If set both Access Key ID and Secret Access -Key must be provided. Session Token and optionally also be provided, but is -not required. - - # Access Key ID - AWS_ACCESS_KEY_ID=AKID - AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. - - # Secret Access Key - AWS_SECRET_ACCESS_KEY=SECRET - AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. - - # Session Token - AWS_SESSION_TOKEN=TOKEN - -Region value will instruct the SDK where to make service API requests to. If is -not provided in the environment the region must be provided before a service -client request is made. - - AWS_REGION=us-east-1 - - # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, - # and AWS_REGION is not also set. - AWS_DEFAULT_REGION=us-east-1 - -Profile name the SDK should load use when loading shared config from the -configuration files. If not provided "default" will be used as the profile name. - - AWS_PROFILE=my_profile - - # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, - # and AWS_PROFILE is not also set. - AWS_DEFAULT_PROFILE=my_profile - -SDK load config instructs the SDK to load the shared config in addition to -shared credentials. This also expands the configuration loaded so the shared -credentials will have parity with the shared config file. This also enables -Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE -env values as well. - - AWS_SDK_LOAD_CONFIG=1 - -Shared credentials file path can be set to instruct the SDK to use an alternative -file for the shared credentials. If not set the file will be loaded from -$HOME/.aws/credentials on Linux/Unix based systems, and -%USERPROFILE%\.aws\credentials on Windows. - - AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials - -Shared config file path can be set to instruct the SDK to use an alternative -file for the shared config. If not set the file will be loaded from -$HOME/.aws/config on Linux/Unix based systems, and -%USERPROFILE%\.aws\config on Windows. - - AWS_CONFIG_FILE=$HOME/my_shared_config - -Path to a custom Credentials Authority (CA) bundle PEM file that the SDK -will use instead of the default system's root CA bundle. Use this only -if you want to replace the CA bundle the SDK uses for TLS requests. - - AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle - -Enabling this option will attempt to merge the Transport into the SDK's HTTP -client. If the client's Transport is not a http.Transport an error will be -returned. If the Transport's TLS config is set this option will cause the SDK -to overwrite the Transport's TLS config's RootCAs value. If the CA bundle file -contains multiple certificates all of them will be loaded. - -The Session option CustomCABundle is also available when creating sessions -to also enable this feature. CustomCABundle session option field has priority -over the AWS_CA_BUNDLE environment variable, and will be used if both are set. - -Setting a custom HTTPClient in the aws.Config options will override this setting. -To use this option and custom HTTP client, the HTTP client needs to be provided -when creating the session. Not the service client. -*/ -package session diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go deleted file mode 100644 index f1adcf48..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ /dev/null @@ -1,191 +0,0 @@ -package session - -import ( - "os" - "strconv" - - "github.com/aws/aws-sdk-go/aws/credentials" -) - -// EnvProviderName provides a name of the provider when config is loaded from environment. -const EnvProviderName = "EnvConfigCredentials" - -// envConfig is a collection of environment values the SDK will read -// setup config from. All environment values are optional. But some values -// such as credentials require multiple values to be complete or the values -// will be ignored. -type envConfig struct { - // Environment configuration values. If set both Access Key ID and Secret Access - // Key must be provided. Session Token and optionally also be provided, but is - // not required. - // - // # Access Key ID - // AWS_ACCESS_KEY_ID=AKID - // AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. - // - // # Secret Access Key - // AWS_SECRET_ACCESS_KEY=SECRET - // AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. - // - // # Session Token - // AWS_SESSION_TOKEN=TOKEN - Creds credentials.Value - - // Region value will instruct the SDK where to make service API requests to. If is - // not provided in the environment the region must be provided before a service - // client request is made. - // - // AWS_REGION=us-east-1 - // - // # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, - // # and AWS_REGION is not also set. - // AWS_DEFAULT_REGION=us-east-1 - Region string - - // Profile name the SDK should load use when loading shared configuration from the - // shared configuration files. If not provided "default" will be used as the - // profile name. - // - // AWS_PROFILE=my_profile - // - // # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, - // # and AWS_PROFILE is not also set. - // AWS_DEFAULT_PROFILE=my_profile - Profile string - - // SDK load config instructs the SDK to load the shared config in addition to - // shared credentials. This also expands the configuration loaded from the shared - // credentials to have parity with the shared config file. This also enables - // Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE - // env values as well. - // - // AWS_SDK_LOAD_CONFIG=1 - EnableSharedConfig bool - - // Shared credentials file path can be set to instruct the SDK to use an alternate - // file for the shared credentials. If not set the file will be loaded from - // $HOME/.aws/credentials on Linux/Unix based systems, and - // %USERPROFILE%\.aws\credentials on Windows. - // - // AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials - SharedCredentialsFile string - - // Shared config file path can be set to instruct the SDK to use an alternate - // file for the shared config. If not set the file will be loaded from - // $HOME/.aws/config on Linux/Unix based systems, and - // %USERPROFILE%\.aws\config on Windows. - // - // AWS_CONFIG_FILE=$HOME/my_shared_config - SharedConfigFile string - - // Sets the path to a custom Credentials Authroity (CA) Bundle PEM file - // that the SDK will use instead of the system's root CA bundle. - // Only use this if you want to configure the SDK to use a custom set - // of CAs. - // - // Enabling this option will attempt to merge the Transport - // into the SDK's HTTP client. If the client's Transport is - // not a http.Transport an error will be returned. If the - // Transport's TLS config is set this option will cause the - // SDK to overwrite the Transport's TLS config's RootCAs value. - // - // Setting a custom HTTPClient in the aws.Config options will override this setting. - // To use this option and custom HTTP client, the HTTP client needs to be provided - // when creating the session. Not the service client. - // - // AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle - CustomCABundle string -} - -var ( - credAccessEnvKey = []string{ - "AWS_ACCESS_KEY_ID", - "AWS_ACCESS_KEY", - } - credSecretEnvKey = []string{ - "AWS_SECRET_ACCESS_KEY", - "AWS_SECRET_KEY", - } - credSessionEnvKey = []string{ - "AWS_SESSION_TOKEN", - } - - regionEnvKeys = []string{ - "AWS_REGION", - "AWS_DEFAULT_REGION", // Only read if AWS_SDK_LOAD_CONFIG is also set - } - profileEnvKeys = []string{ - "AWS_PROFILE", - "AWS_DEFAULT_PROFILE", // Only read if AWS_SDK_LOAD_CONFIG is also set - } - sharedCredsFileEnvKey = []string{ - "AWS_SHARED_CREDENTIALS_FILE", - } - sharedConfigFileEnvKey = []string{ - "AWS_CONFIG_FILE", - } -) - -// loadEnvConfig retrieves the SDK's environment configuration. -// See `envConfig` for the values that will be retrieved. -// -// If the environment variable `AWS_SDK_LOAD_CONFIG` is set to a truthy value -// the shared SDK config will be loaded in addition to the SDK's specific -// configuration values. -func loadEnvConfig() envConfig { - enableSharedConfig, _ := strconv.ParseBool(os.Getenv("AWS_SDK_LOAD_CONFIG")) - return envConfigLoad(enableSharedConfig) -} - -// loadEnvSharedConfig retrieves the SDK's environment configuration, and the -// SDK shared config. See `envConfig` for the values that will be retrieved. -// -// Loads the shared configuration in addition to the SDK's specific configuration. -// This will load the same values as `loadEnvConfig` if the `AWS_SDK_LOAD_CONFIG` -// environment variable is set. -func loadSharedEnvConfig() envConfig { - return envConfigLoad(true) -} - -func envConfigLoad(enableSharedConfig bool) envConfig { - cfg := envConfig{} - - cfg.EnableSharedConfig = enableSharedConfig - - setFromEnvVal(&cfg.Creds.AccessKeyID, credAccessEnvKey) - setFromEnvVal(&cfg.Creds.SecretAccessKey, credSecretEnvKey) - setFromEnvVal(&cfg.Creds.SessionToken, credSessionEnvKey) - - // Require logical grouping of credentials - if len(cfg.Creds.AccessKeyID) == 0 || len(cfg.Creds.SecretAccessKey) == 0 { - cfg.Creds = credentials.Value{} - } else { - cfg.Creds.ProviderName = EnvProviderName - } - - regionKeys := regionEnvKeys - profileKeys := profileEnvKeys - if !cfg.EnableSharedConfig { - regionKeys = regionKeys[:1] - profileKeys = profileKeys[:1] - } - - setFromEnvVal(&cfg.Region, regionKeys) - setFromEnvVal(&cfg.Profile, profileKeys) - - setFromEnvVal(&cfg.SharedCredentialsFile, sharedCredsFileEnvKey) - setFromEnvVal(&cfg.SharedConfigFile, sharedConfigFileEnvKey) - - cfg.CustomCABundle = os.Getenv("AWS_CA_BUNDLE") - - return cfg -} - -func setFromEnvVal(dst *string, keys []string) { - for _, k := range keys { - if v := os.Getenv(k); len(v) > 0 { - *dst = v - break - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go deleted file mode 100644 index 10e3662a..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go +++ /dev/null @@ -1,279 +0,0 @@ -package session - -import ( - "os" - "reflect" - "testing" - - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/awstesting" -) - -func TestLoadEnvConfig_Creds(t *testing.T) { - env := awstesting.StashEnv() - defer awstesting.PopEnv(env) - - cases := []struct { - Env map[string]string - Val credentials.Value - }{ - { - Env: map[string]string{ - "AWS_ACCESS_KEY": "AKID", - }, - Val: credentials.Value{}, - }, - { - Env: map[string]string{ - "AWS_ACCESS_KEY_ID": "AKID", - }, - Val: credentials.Value{}, - }, - { - Env: map[string]string{ - "AWS_SECRET_KEY": "SECRET", - }, - Val: credentials.Value{}, - }, - { - Env: map[string]string{ - "AWS_SECRET_ACCESS_KEY": "SECRET", - }, - Val: credentials.Value{}, - }, - { - Env: map[string]string{ - "AWS_ACCESS_KEY_ID": "AKID", - "AWS_SECRET_ACCESS_KEY": "SECRET", - }, - Val: credentials.Value{ - AccessKeyID: "AKID", SecretAccessKey: "SECRET", - ProviderName: "EnvConfigCredentials", - }, - }, - { - Env: map[string]string{ - "AWS_ACCESS_KEY": "AKID", - "AWS_SECRET_KEY": "SECRET", - }, - Val: credentials.Value{ - AccessKeyID: "AKID", SecretAccessKey: "SECRET", - ProviderName: "EnvConfigCredentials", - }, - }, - { - Env: map[string]string{ - "AWS_ACCESS_KEY": "AKID", - "AWS_SECRET_KEY": "SECRET", - "AWS_SESSION_TOKEN": "TOKEN", - }, - Val: credentials.Value{ - AccessKeyID: "AKID", SecretAccessKey: "SECRET", SessionToken: "TOKEN", - ProviderName: "EnvConfigCredentials", - }, - }, - } - - for _, c := range cases { - os.Clearenv() - - for k, v := range c.Env { - os.Setenv(k, v) - } - - cfg := loadEnvConfig() - if !reflect.DeepEqual(c.Val, cfg.Creds) { - t.Errorf("expect credentials to match.\n%s", - awstesting.SprintExpectActual(c.Val, cfg.Creds)) - } - } -} - -func TestLoadEnvConfig(t *testing.T) { - env := awstesting.StashEnv() - defer awstesting.PopEnv(env) - - cases := []struct { - Env map[string]string - UseSharedConfigCall bool - Config envConfig - }{ - { - Env: map[string]string{ - "AWS_REGION": "region", - "AWS_PROFILE": "profile", - }, - Config: envConfig{ - Region: "region", Profile: "profile", - }, - }, - { - Env: map[string]string{ - "AWS_REGION": "region", - "AWS_DEFAULT_REGION": "default_region", - "AWS_PROFILE": "profile", - "AWS_DEFAULT_PROFILE": "default_profile", - }, - Config: envConfig{ - Region: "region", Profile: "profile", - }, - }, - { - Env: map[string]string{ - "AWS_REGION": "region", - "AWS_DEFAULT_REGION": "default_region", - "AWS_PROFILE": "profile", - "AWS_DEFAULT_PROFILE": "default_profile", - "AWS_SDK_LOAD_CONFIG": "1", - }, - Config: envConfig{ - Region: "region", Profile: "profile", - EnableSharedConfig: true, - }, - }, - { - Env: map[string]string{ - "AWS_DEFAULT_REGION": "default_region", - "AWS_DEFAULT_PROFILE": "default_profile", - }, - }, - { - Env: map[string]string{ - "AWS_DEFAULT_REGION": "default_region", - "AWS_DEFAULT_PROFILE": "default_profile", - "AWS_SDK_LOAD_CONFIG": "1", - }, - Config: envConfig{ - Region: "default_region", Profile: "default_profile", - EnableSharedConfig: true, - }, - }, - { - Env: map[string]string{ - "AWS_REGION": "region", - "AWS_PROFILE": "profile", - }, - Config: envConfig{ - Region: "region", Profile: "profile", - EnableSharedConfig: true, - }, - UseSharedConfigCall: true, - }, - { - Env: map[string]string{ - "AWS_REGION": "region", - "AWS_DEFAULT_REGION": "default_region", - "AWS_PROFILE": "profile", - "AWS_DEFAULT_PROFILE": "default_profile", - }, - Config: envConfig{ - Region: "region", Profile: "profile", - EnableSharedConfig: true, - }, - UseSharedConfigCall: true, - }, - { - Env: map[string]string{ - "AWS_REGION": "region", - "AWS_DEFAULT_REGION": "default_region", - "AWS_PROFILE": "profile", - "AWS_DEFAULT_PROFILE": "default_profile", - "AWS_SDK_LOAD_CONFIG": "1", - }, - Config: envConfig{ - Region: "region", Profile: "profile", - EnableSharedConfig: true, - }, - UseSharedConfigCall: true, - }, - { - Env: map[string]string{ - "AWS_DEFAULT_REGION": "default_region", - "AWS_DEFAULT_PROFILE": "default_profile", - }, - Config: envConfig{ - Region: "default_region", Profile: "default_profile", - EnableSharedConfig: true, - }, - UseSharedConfigCall: true, - }, - { - Env: map[string]string{ - "AWS_DEFAULT_REGION": "default_region", - "AWS_DEFAULT_PROFILE": "default_profile", - "AWS_SDK_LOAD_CONFIG": "1", - }, - Config: envConfig{ - Region: "default_region", Profile: "default_profile", - EnableSharedConfig: true, - }, - UseSharedConfigCall: true, - }, - { - Env: map[string]string{ - "AWS_CA_BUNDLE": "custom_ca_bundle", - }, - Config: envConfig{ - CustomCABundle: "custom_ca_bundle", - }, - }, - { - Env: map[string]string{ - "AWS_CA_BUNDLE": "custom_ca_bundle", - }, - Config: envConfig{ - CustomCABundle: "custom_ca_bundle", - EnableSharedConfig: true, - }, - UseSharedConfigCall: true, - }, - { - Env: map[string]string{ - "AWS_SHARED_CREDENTIALS_FILE": "/path/to/credentials/file", - "AWS_CONFIG_FILE": "/path/to/config/file", - }, - Config: envConfig{ - SharedCredentialsFile: "/path/to/credentials/file", - SharedConfigFile: "/path/to/config/file", - }, - }, - } - - for _, c := range cases { - os.Clearenv() - - for k, v := range c.Env { - os.Setenv(k, v) - } - - var cfg envConfig - if c.UseSharedConfigCall { - cfg = loadSharedEnvConfig() - } else { - cfg = loadEnvConfig() - } - - if !reflect.DeepEqual(c.Config, cfg) { - t.Errorf("expect config to match.\n%s", - awstesting.SprintExpectActual(c.Config, cfg)) - } - } -} - -func TestSetEnvValue(t *testing.T) { - env := awstesting.StashEnv() - defer awstesting.PopEnv(env) - - os.Setenv("empty_key", "") - os.Setenv("second_key", "2") - os.Setenv("third_key", "3") - - var dst string - setFromEnvVal(&dst, []string{ - "empty_key", "first_key", "second_key", "third_key", - }) - - if e, a := "2", dst; e != a { - t.Errorf("expect %s value from environment, got %s", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go deleted file mode 100644 index 9f75d5ac..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ /dev/null @@ -1,606 +0,0 @@ -package session - -import ( - "crypto/tls" - "crypto/x509" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/stscreds" - "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/request" -) - -// A Session provides a central location to create service clients from and -// store configurations and request handlers for those services. -// -// Sessions are safe to create service clients concurrently, but it is not safe -// to mutate the Session concurrently. -// -// The Session satisfies the service client's client.ClientConfigProvider. -type Session struct { - Config *aws.Config - Handlers request.Handlers -} - -// New creates a new instance of the handlers merging in the provided configs -// on top of the SDK's default configurations. Once the Session is created it -// can be mutated to modify the Config or Handlers. The Session is safe to be -// read concurrently, but it should not be written to concurrently. -// -// If the AWS_SDK_LOAD_CONFIG environment is set to a truthy value, the New -// method could now encounter an error when loading the configuration. When -// The environment variable is set, and an error occurs, New will return a -// session that will fail all requests reporting the error that occurred while -// loading the session. Use NewSession to get the error when creating the -// session. -// -// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value -// the shared config file (~/.aws/config) will also be loaded, in addition to -// the shared credentials file (~/.aws/credentials). Values set in both the -// shared config, and shared credentials will be taken from the shared -// credentials file. -// -// Deprecated: Use NewSession functions to create sessions instead. NewSession -// has the same functionality as New except an error can be returned when the -// func is called instead of waiting to receive an error until a request is made. -func New(cfgs ...*aws.Config) *Session { - // load initial config from environment - envCfg := loadEnvConfig() - - if envCfg.EnableSharedConfig { - s, err := newSession(Options{}, envCfg, cfgs...) - if err != nil { - // Old session.New expected all errors to be discovered when - // a request is made, and would report the errors then. This - // needs to be replicated if an error occurs while creating - // the session. - msg := "failed to create session with AWS_SDK_LOAD_CONFIG enabled. " + - "Use session.NewSession to handle errors occurring during session creation." - - // Session creation failed, need to report the error and prevent - // any requests from succeeding. - s = &Session{Config: defaults.Config()} - s.Config.MergeIn(cfgs...) - s.Config.Logger.Log("ERROR:", msg, "Error:", err) - s.Handlers.Validate.PushBack(func(r *request.Request) { - r.Error = err - }) - } - return s - } - - return deprecatedNewSession(cfgs...) -} - -// NewSession returns a new Session created from SDK defaults, config files, -// environment, and user provided config files. Once the Session is created -// it can be mutated to modify the Config or Handlers. The Session is safe to -// be read concurrently, but it should not be written to concurrently. -// -// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value -// the shared config file (~/.aws/config) will also be loaded in addition to -// the shared credentials file (~/.aws/credentials). Values set in both the -// shared config, and shared credentials will be taken from the shared -// credentials file. Enabling the Shared Config will also allow the Session -// to be built with retrieving credentials with AssumeRole set in the config. -// -// See the NewSessionWithOptions func for information on how to override or -// control through code how the Session will be created. Such as specifying the -// config profile, and controlling if shared config is enabled or not. -func NewSession(cfgs ...*aws.Config) (*Session, error) { - opts := Options{} - opts.Config.MergeIn(cfgs...) - - return NewSessionWithOptions(opts) -} - -// SharedConfigState provides the ability to optionally override the state -// of the session's creation based on the shared config being enabled or -// disabled. -type SharedConfigState int - -const ( - // SharedConfigStateFromEnv does not override any state of the - // AWS_SDK_LOAD_CONFIG env var. It is the default value of the - // SharedConfigState type. - SharedConfigStateFromEnv SharedConfigState = iota - - // SharedConfigDisable overrides the AWS_SDK_LOAD_CONFIG env var value - // and disables the shared config functionality. - SharedConfigDisable - - // SharedConfigEnable overrides the AWS_SDK_LOAD_CONFIG env var value - // and enables the shared config functionality. - SharedConfigEnable -) - -// Options provides the means to control how a Session is created and what -// configuration values will be loaded. -// -type Options struct { - // Provides config values for the SDK to use when creating service clients - // and making API requests to services. Any value set in with this field - // will override the associated value provided by the SDK defaults, - // environment or config files where relevant. - // - // If not set, configuration values from from SDK defaults, environment, - // config will be used. - Config aws.Config - - // Overrides the config profile the Session should be created from. If not - // set the value of the environment variable will be loaded (AWS_PROFILE, - // or AWS_DEFAULT_PROFILE if the Shared Config is enabled). - // - // If not set and environment variables are not set the "default" - // (DefaultSharedConfigProfile) will be used as the profile to load the - // session config from. - Profile string - - // Instructs how the Session will be created based on the AWS_SDK_LOAD_CONFIG - // environment variable. By default a Session will be created using the - // value provided by the AWS_SDK_LOAD_CONFIG environment variable. - // - // Setting this value to SharedConfigEnable or SharedConfigDisable - // will allow you to override the AWS_SDK_LOAD_CONFIG environment variable - // and enable or disable the shared config functionality. - SharedConfigState SharedConfigState - - // Ordered list of files the session will load configuration from. - // It will override environment variable AWS_SHARED_CREDENTIALS_FILE, AWS_CONFIG_FILE. - SharedConfigFiles []string - - // When the SDK's shared config is configured to assume a role with MFA - // this option is required in order to provide the mechanism that will - // retrieve the MFA token. There is no default value for this field. If - // it is not set an error will be returned when creating the session. - // - // This token provider will be called when ever the assumed role's - // credentials need to be refreshed. Within the context of service clients - // all sharing the same session the SDK will ensure calls to the token - // provider are atomic. When sharing a token provider across multiple - // sessions additional synchronization logic is needed to ensure the - // token providers do not introduce race conditions. It is recommend to - // share the session where possible. - // - // stscreds.StdinTokenProvider is a basic implementation that will prompt - // from stdin for the MFA token code. - // - // This field is only used if the shared configuration is enabled, and - // the config enables assume role wit MFA via the mfa_serial field. - AssumeRoleTokenProvider func() (string, error) - - // Reader for a custom Credentials Authority (CA) bundle in PEM format that - // the SDK will use instead of the default system's root CA bundle. Use this - // only if you want to replace the CA bundle the SDK uses for TLS requests. - // - // Enabling this option will attempt to merge the Transport into the SDK's HTTP - // client. If the client's Transport is not a http.Transport an error will be - // returned. If the Transport's TLS config is set this option will cause the SDK - // to overwrite the Transport's TLS config's RootCAs value. If the CA - // bundle reader contains multiple certificates all of them will be loaded. - // - // The Session option CustomCABundle is also available when creating sessions - // to also enable this feature. CustomCABundle session option field has priority - // over the AWS_CA_BUNDLE environment variable, and will be used if both are set. - CustomCABundle io.Reader -} - -// NewSessionWithOptions returns a new Session created from SDK defaults, config files, -// environment, and user provided config files. This func uses the Options -// values to configure how the Session is created. -// -// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value -// the shared config file (~/.aws/config) will also be loaded in addition to -// the shared credentials file (~/.aws/credentials). Values set in both the -// shared config, and shared credentials will be taken from the shared -// credentials file. Enabling the Shared Config will also allow the Session -// to be built with retrieving credentials with AssumeRole set in the config. -// -// // Equivalent to session.New -// sess := session.Must(session.NewSessionWithOptions(session.Options{})) -// -// // Specify profile to load for the session's config -// sess := session.Must(session.NewSessionWithOptions(session.Options{ -// Profile: "profile_name", -// })) -// -// // Specify profile for config and region for requests -// sess := session.Must(session.NewSessionWithOptions(session.Options{ -// Config: aws.Config{Region: aws.String("us-east-1")}, -// Profile: "profile_name", -// })) -// -// // Force enable Shared Config support -// sess := session.Must(session.NewSessionWithOptions(session.Options{ -// SharedConfigState: session.SharedConfigEnable, -// })) -func NewSessionWithOptions(opts Options) (*Session, error) { - var envCfg envConfig - if opts.SharedConfigState == SharedConfigEnable { - envCfg = loadSharedEnvConfig() - } else { - envCfg = loadEnvConfig() - } - - if len(opts.Profile) > 0 { - envCfg.Profile = opts.Profile - } - - switch opts.SharedConfigState { - case SharedConfigDisable: - envCfg.EnableSharedConfig = false - case SharedConfigEnable: - envCfg.EnableSharedConfig = true - } - - if len(envCfg.SharedCredentialsFile) == 0 { - envCfg.SharedCredentialsFile = defaults.SharedCredentialsFilename() - } - if len(envCfg.SharedConfigFile) == 0 { - envCfg.SharedConfigFile = defaults.SharedConfigFilename() - } - - // Only use AWS_CA_BUNDLE if session option is not provided. - if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { - f, err := os.Open(envCfg.CustomCABundle) - if err != nil { - return nil, awserr.New("LoadCustomCABundleError", - "failed to open custom CA bundle PEM file", err) - } - defer f.Close() - opts.CustomCABundle = f - } - - return newSession(opts, envCfg, &opts.Config) -} - -// Must is a helper function to ensure the Session is valid and there was no -// error when calling a NewSession function. -// -// This helper is intended to be used in variable initialization to load the -// Session and configuration at startup. Such as: -// -// var sess = session.Must(session.NewSession()) -func Must(sess *Session, err error) *Session { - if err != nil { - panic(err) - } - - return sess -} - -func deprecatedNewSession(cfgs ...*aws.Config) *Session { - cfg := defaults.Config() - handlers := defaults.Handlers() - - // Apply the passed in configs so the configuration can be applied to the - // default credential chain - cfg.MergeIn(cfgs...) - if cfg.EndpointResolver == nil { - // An endpoint resolver is required for a session to be able to provide - // endpoints for service client configurations. - cfg.EndpointResolver = endpoints.DefaultResolver() - } - cfg.Credentials = defaults.CredChain(cfg, handlers) - - // Reapply any passed in configs to override credentials if set - cfg.MergeIn(cfgs...) - - s := &Session{ - Config: cfg, - Handlers: handlers, - } - - initHandlers(s) - - return s -} - -func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { - cfg := defaults.Config() - handlers := defaults.Handlers() - - // Get a merged version of the user provided config to determine if - // credentials were. - userCfg := &aws.Config{} - userCfg.MergeIn(cfgs...) - - // Ordered config files will be loaded in with later files overwriting - // previous config file values. - var cfgFiles []string - if opts.SharedConfigFiles != nil { - cfgFiles = opts.SharedConfigFiles - } else { - cfgFiles = []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} - if !envCfg.EnableSharedConfig { - // The shared config file (~/.aws/config) is only loaded if instructed - // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). - cfgFiles = cfgFiles[1:] - } - } - - // Load additional config from file(s) - sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles) - if err != nil { - return nil, err - } - - if err := mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers, opts); err != nil { - return nil, err - } - - s := &Session{ - Config: cfg, - Handlers: handlers, - } - - initHandlers(s) - - // Setup HTTP client with custom cert bundle if enabled - if opts.CustomCABundle != nil { - if err := loadCustomCABundle(s, opts.CustomCABundle); err != nil { - return nil, err - } - } - - return s, nil -} - -func loadCustomCABundle(s *Session, bundle io.Reader) error { - var t *http.Transport - switch v := s.Config.HTTPClient.Transport.(type) { - case *http.Transport: - t = v - default: - if s.Config.HTTPClient.Transport != nil { - return awserr.New("LoadCustomCABundleError", - "unable to load custom CA bundle, HTTPClient's transport unsupported type", nil) - } - } - if t == nil { - t = &http.Transport{} - } - - p, err := loadCertPool(bundle) - if err != nil { - return err - } - if t.TLSClientConfig == nil { - t.TLSClientConfig = &tls.Config{} - } - t.TLSClientConfig.RootCAs = p - - s.Config.HTTPClient.Transport = t - - return nil -} - -func loadCertPool(r io.Reader) (*x509.CertPool, error) { - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, awserr.New("LoadCustomCABundleError", - "failed to read custom CA bundle PEM file", err) - } - - p := x509.NewCertPool() - if !p.AppendCertsFromPEM(b) { - return nil, awserr.New("LoadCustomCABundleError", - "failed to load custom CA bundle PEM file", err) - } - - return p, nil -} - -func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers, sessOpts Options) error { - // Merge in user provided configuration - cfg.MergeIn(userCfg) - - // Region if not already set by user - if len(aws.StringValue(cfg.Region)) == 0 { - if len(envCfg.Region) > 0 { - cfg.WithRegion(envCfg.Region) - } else if envCfg.EnableSharedConfig && len(sharedCfg.Region) > 0 { - cfg.WithRegion(sharedCfg.Region) - } - } - - // Configure credentials if not already set - if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil { - if len(envCfg.Creds.AccessKeyID) > 0 { - cfg.Credentials = credentials.NewStaticCredentialsFromCreds( - envCfg.Creds, - ) - } else if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.RoleARN) > 0 && sharedCfg.AssumeRoleSource != nil { - cfgCp := *cfg - cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds( - sharedCfg.AssumeRoleSource.Creds, - ) - if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { - // AssumeRole Token provider is required if doing Assume Role - // with MFA. - return AssumeRoleTokenProviderNotSetError{} - } - cfg.Credentials = stscreds.NewCredentials( - &Session{ - Config: &cfgCp, - Handlers: handlers.Copy(), - }, - sharedCfg.AssumeRole.RoleARN, - func(opt *stscreds.AssumeRoleProvider) { - opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName - - // Assume role with external ID - if len(sharedCfg.AssumeRole.ExternalID) > 0 { - opt.ExternalID = aws.String(sharedCfg.AssumeRole.ExternalID) - } - - // Assume role with MFA - if len(sharedCfg.AssumeRole.MFASerial) > 0 { - opt.SerialNumber = aws.String(sharedCfg.AssumeRole.MFASerial) - opt.TokenProvider = sessOpts.AssumeRoleTokenProvider - } - }, - ) - } else if len(sharedCfg.Creds.AccessKeyID) > 0 { - cfg.Credentials = credentials.NewStaticCredentialsFromCreds( - sharedCfg.Creds, - ) - } else { - // Fallback to default credentials provider, include mock errors - // for the credential chain so user can identify why credentials - // failed to be retrieved. - cfg.Credentials = credentials.NewCredentials(&credentials.ChainProvider{ - VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), - Providers: []credentials.Provider{ - &credProviderError{Err: awserr.New("EnvAccessKeyNotFound", "failed to find credentials in the environment.", nil)}, - &credProviderError{Err: awserr.New("SharedCredsLoad", fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil)}, - defaults.RemoteCredProvider(*cfg, handlers), - }, - }) - } - } - - return nil -} - -// AssumeRoleTokenProviderNotSetError is an error returned when creating a session when the -// MFAToken option is not set when shared config is configured load assume a -// role with an MFA token. -type AssumeRoleTokenProviderNotSetError struct{} - -// Code is the short id of the error. -func (e AssumeRoleTokenProviderNotSetError) Code() string { - return "AssumeRoleTokenProviderNotSetError" -} - -// Message is the description of the error -func (e AssumeRoleTokenProviderNotSetError) Message() string { - return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") -} - -// OrigErr is the underlying error that caused the failure. -func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e AssumeRoleTokenProviderNotSetError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} - -type credProviderError struct { - Err error -} - -var emptyCreds = credentials.Value{} - -func (c credProviderError) Retrieve() (credentials.Value, error) { - return credentials.Value{}, c.Err -} -func (c credProviderError) IsExpired() bool { - return true -} - -func initHandlers(s *Session) { - // Add the Validate parameter handler if it is not disabled. - s.Handlers.Validate.Remove(corehandlers.ValidateParametersHandler) - if !aws.BoolValue(s.Config.DisableParamValidation) { - s.Handlers.Validate.PushBackNamed(corehandlers.ValidateParametersHandler) - } -} - -// Copy creates and returns a copy of the current Session, coping the config -// and handlers. If any additional configs are provided they will be merged -// on top of the Session's copied config. -// -// // Create a copy of the current Session, configured for the us-west-2 region. -// sess.Copy(&aws.Config{Region: aws.String("us-west-2")}) -func (s *Session) Copy(cfgs ...*aws.Config) *Session { - newSession := &Session{ - Config: s.Config.Copy(cfgs...), - Handlers: s.Handlers.Copy(), - } - - initHandlers(newSession) - - return newSession -} - -// ClientConfig satisfies the client.ConfigProvider interface and is used to -// configure the service client instances. Passing the Session to the service -// client's constructor (New) will use this method to configure the client. -func (s *Session) ClientConfig(serviceName string, cfgs ...*aws.Config) client.Config { - // Backwards compatibility, the error will be eaten if user calls ClientConfig - // directly. All SDK services will use ClientconfigWithError. - cfg, _ := s.clientConfigWithErr(serviceName, cfgs...) - - return cfg -} - -func (s *Session) clientConfigWithErr(serviceName string, cfgs ...*aws.Config) (client.Config, error) { - s = s.Copy(cfgs...) - - var resolved endpoints.ResolvedEndpoint - var err error - - region := aws.StringValue(s.Config.Region) - - if endpoint := aws.StringValue(s.Config.Endpoint); len(endpoint) != 0 { - resolved.URL = endpoints.AddScheme(endpoint, aws.BoolValue(s.Config.DisableSSL)) - resolved.SigningRegion = region - } else { - resolved, err = s.Config.EndpointResolver.EndpointFor( - serviceName, region, - func(opt *endpoints.Options) { - opt.DisableSSL = aws.BoolValue(s.Config.DisableSSL) - opt.UseDualStack = aws.BoolValue(s.Config.UseDualStack) - - // Support the condition where the service is modeled but its - // endpoint metadata is not available. - opt.ResolveUnknownService = true - }, - ) - } - - return client.Config{ - Config: s.Config, - Handlers: s.Handlers, - Endpoint: resolved.URL, - SigningRegion: resolved.SigningRegion, - SigningName: resolved.SigningName, - }, err -} - -// ClientConfigNoResolveEndpoint is the same as ClientConfig with the exception -// that the EndpointResolver will not be used to resolve the endpoint. The only -// endpoint set must come from the aws.Config.Endpoint field. -func (s *Session) ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) client.Config { - s = s.Copy(cfgs...) - - var resolved endpoints.ResolvedEndpoint - - region := aws.StringValue(s.Config.Region) - - if ep := aws.StringValue(s.Config.Endpoint); len(ep) > 0 { - resolved.URL = endpoints.AddScheme(ep, aws.BoolValue(s.Config.DisableSSL)) - resolved.SigningRegion = region - } - - return client.Config{ - Config: s.Config, - Handlers: s.Handlers, - Endpoint: resolved.URL, - SigningRegion: resolved.SigningRegion, - SigningName: resolved.SigningName, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go deleted file mode 100644 index 9612b315..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go +++ /dev/null @@ -1,446 +0,0 @@ -package session - -import ( - "bytes" - "fmt" - "net/http" - "net/http/httptest" - "os" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/service/s3" -) - -func TestNewDefaultSession(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - s := New(&aws.Config{Region: aws.String("region")}) - - assert.Equal(t, "region", *s.Config.Region) - assert.Equal(t, http.DefaultClient, s.Config.HTTPClient) - assert.NotNil(t, s.Config.Logger) - assert.Equal(t, aws.LogOff, *s.Config.LogLevel) -} - -func TestNew_WithCustomCreds(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - customCreds := credentials.NewStaticCredentials("AKID", "SECRET", "TOKEN") - s := New(&aws.Config{Credentials: customCreds}) - - assert.Equal(t, customCreds, s.Config.Credentials) -} - -type mockLogger struct { - *bytes.Buffer -} - -func (w mockLogger) Log(args ...interface{}) { - fmt.Fprintln(w, args...) -} - -func TestNew_WithSessionLoadError(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_CONFIG_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "assume_role_invalid_source_profile") - - logger := bytes.Buffer{} - s := New(&aws.Config{Logger: &mockLogger{&logger}}) - - assert.NotNil(t, s) - - svc := s3.New(s) - _, err := svc.ListBuckets(&s3.ListBucketsInput{}) - - assert.Error(t, err) - assert.Contains(t, logger.String(), "ERROR: failed to create session with AWS_SDK_LOAD_CONFIG enabled") - assert.Contains(t, err.Error(), SharedConfigAssumeRoleError{ - RoleARN: "assume_role_invalid_source_profile_role_arn", - }.Error()) -} - -func TestSessionCopy(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_REGION", "orig_region") - - s := Session{ - Config: defaults.Config(), - Handlers: defaults.Handlers(), - } - - newSess := s.Copy(&aws.Config{Region: aws.String("new_region")}) - - assert.Equal(t, "orig_region", *s.Config.Region) - assert.Equal(t, "new_region", *newSess.Config.Region) -} - -func TestSessionClientConfig(t *testing.T) { - s, err := NewSession(&aws.Config{ - Credentials: credentials.AnonymousCredentials, - Region: aws.String("orig_region"), - EndpointResolver: endpoints.ResolverFunc( - func(service, region string, opts ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { - if e, a := "mock-service", service; e != a { - t.Errorf("expect %q service, got %q", e, a) - } - if e, a := "other-region", region; e != a { - t.Errorf("expect %q region, got %q", e, a) - } - return endpoints.ResolvedEndpoint{ - URL: "https://" + service + "." + region + ".amazonaws.com", - SigningRegion: region, - }, nil - }, - ), - }) - assert.NoError(t, err) - - cfg := s.ClientConfig("mock-service", &aws.Config{Region: aws.String("other-region")}) - - assert.Equal(t, "https://mock-service.other-region.amazonaws.com", cfg.Endpoint) - assert.Equal(t, "other-region", cfg.SigningRegion) - assert.Equal(t, "other-region", *cfg.Config.Region) -} - -func TestNewSession_NoCredentials(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - s, err := NewSession() - assert.NoError(t, err) - - assert.NotNil(t, s.Config.Credentials) - assert.NotEqual(t, credentials.AnonymousCredentials, s.Config.Credentials) -} - -func TestNewSessionWithOptions_OverrideProfile(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "other_profile") - - s, err := NewSessionWithOptions(Options{ - Profile: "full_profile", - }) - assert.NoError(t, err) - - assert.Equal(t, "full_profile_region", *s.Config.Region) - - creds, err := s.Config.Credentials.Get() - assert.NoError(t, err) - assert.Equal(t, "full_profile_akid", creds.AccessKeyID) - assert.Equal(t, "full_profile_secret", creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) - assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") -} - -func TestNewSessionWithOptions_OverrideSharedConfigEnable(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_SDK_LOAD_CONFIG", "0") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "full_profile") - - s, err := NewSessionWithOptions(Options{ - SharedConfigState: SharedConfigEnable, - }) - assert.NoError(t, err) - - assert.Equal(t, "full_profile_region", *s.Config.Region) - - creds, err := s.Config.Credentials.Get() - assert.NoError(t, err) - assert.Equal(t, "full_profile_akid", creds.AccessKeyID) - assert.Equal(t, "full_profile_secret", creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) - assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") -} - -func TestNewSessionWithOptions_OverrideSharedConfigDisable(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "full_profile") - - s, err := NewSessionWithOptions(Options{ - SharedConfigState: SharedConfigDisable, - }) - assert.NoError(t, err) - - assert.Empty(t, *s.Config.Region) - - creds, err := s.Config.Credentials.Get() - assert.NoError(t, err) - assert.Equal(t, "full_profile_akid", creds.AccessKeyID) - assert.Equal(t, "full_profile_secret", creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) - assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") -} - -func TestNewSessionWithOptions_OverrideSharedConfigFiles(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "config_file_load_order") - - s, err := NewSessionWithOptions(Options{ - SharedConfigFiles: []string{testConfigOtherFilename}, - }) - assert.NoError(t, err) - - assert.Equal(t, "shared_config_other_region", *s.Config.Region) - - creds, err := s.Config.Credentials.Get() - assert.NoError(t, err) - assert.Equal(t, "shared_config_other_akid", creds.AccessKeyID) - assert.Equal(t, "shared_config_other_secret", creds.SecretAccessKey) - assert.Empty(t, creds.SessionToken) - assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") -} - -func TestNewSessionWithOptions_Overrides(t *testing.T) { - cases := []struct { - InEnvs map[string]string - InProfile string - OutRegion string - OutCreds credentials.Value - }{ - { - InEnvs: map[string]string{ - "AWS_SDK_LOAD_CONFIG": "0", - "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename, - "AWS_PROFILE": "other_profile", - }, - InProfile: "full_profile", - OutRegion: "full_profile_region", - OutCreds: credentials.Value{ - AccessKeyID: "full_profile_akid", - SecretAccessKey: "full_profile_secret", - ProviderName: "SharedConfigCredentials", - }, - }, - { - InEnvs: map[string]string{ - "AWS_SDK_LOAD_CONFIG": "0", - "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename, - "AWS_REGION": "env_region", - "AWS_ACCESS_KEY": "env_akid", - "AWS_SECRET_ACCESS_KEY": "env_secret", - "AWS_PROFILE": "other_profile", - }, - InProfile: "full_profile", - OutRegion: "env_region", - OutCreds: credentials.Value{ - AccessKeyID: "env_akid", - SecretAccessKey: "env_secret", - ProviderName: "EnvConfigCredentials", - }, - }, - { - InEnvs: map[string]string{ - "AWS_SDK_LOAD_CONFIG": "0", - "AWS_SHARED_CREDENTIALS_FILE": testConfigFilename, - "AWS_CONFIG_FILE": testConfigOtherFilename, - "AWS_PROFILE": "shared_profile", - }, - InProfile: "config_file_load_order", - OutRegion: "shared_config_region", - OutCreds: credentials.Value{ - AccessKeyID: "shared_config_akid", - SecretAccessKey: "shared_config_secret", - ProviderName: "SharedConfigCredentials", - }, - }, - } - - for _, c := range cases { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - for k, v := range c.InEnvs { - os.Setenv(k, v) - } - - s, err := NewSessionWithOptions(Options{ - Profile: c.InProfile, - SharedConfigState: SharedConfigEnable, - }) - assert.NoError(t, err) - - creds, err := s.Config.Credentials.Get() - assert.NoError(t, err) - assert.Equal(t, c.OutRegion, *s.Config.Region) - assert.Equal(t, c.OutCreds.AccessKeyID, creds.AccessKeyID) - assert.Equal(t, c.OutCreds.SecretAccessKey, creds.SecretAccessKey) - assert.Equal(t, c.OutCreds.SessionToken, creds.SessionToken) - assert.Contains(t, creds.ProviderName, c.OutCreds.ProviderName) - } -} - -const assumeRoleRespMsg = ` - - - - arn:aws:sts::account_id:assumed-role/role/session_name - AKID:session_name - - - AKID - SECRET - SESSION_TOKEN - %s - - - - request-id - - -` - -func TestSesisonAssumeRole(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_REGION", "us-east-1") - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "assume_role_w_creds") - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(fmt.Sprintf(assumeRoleRespMsg, time.Now().Add(15*time.Minute).Format("2006-01-02T15:04:05Z")))) - })) - - s, err := NewSession(&aws.Config{Endpoint: aws.String(server.URL), DisableSSL: aws.Bool(true)}) - - creds, err := s.Config.Credentials.Get() - assert.NoError(t, err) - assert.Equal(t, "AKID", creds.AccessKeyID) - assert.Equal(t, "SECRET", creds.SecretAccessKey) - assert.Equal(t, "SESSION_TOKEN", creds.SessionToken) - assert.Contains(t, creds.ProviderName, "AssumeRoleProvider") -} - -func TestSessionAssumeRole_WithMFA(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_REGION", "us-east-1") - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "assume_role_w_creds") - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, r.FormValue("SerialNumber"), "0123456789") - assert.Equal(t, r.FormValue("TokenCode"), "tokencode") - - w.Write([]byte(fmt.Sprintf(assumeRoleRespMsg, time.Now().Add(15*time.Minute).Format("2006-01-02T15:04:05Z")))) - })) - - customProviderCalled := false - sess, err := NewSessionWithOptions(Options{ - Profile: "assume_role_w_mfa", - Config: aws.Config{ - Region: aws.String("us-east-1"), - Endpoint: aws.String(server.URL), - DisableSSL: aws.Bool(true), - }, - SharedConfigState: SharedConfigEnable, - AssumeRoleTokenProvider: func() (string, error) { - customProviderCalled = true - - return "tokencode", nil - }, - }) - assert.NoError(t, err) - - creds, err := sess.Config.Credentials.Get() - assert.NoError(t, err) - assert.True(t, customProviderCalled) - - assert.Equal(t, "AKID", creds.AccessKeyID) - assert.Equal(t, "SECRET", creds.SecretAccessKey) - assert.Equal(t, "SESSION_TOKEN", creds.SessionToken) - assert.Contains(t, creds.ProviderName, "AssumeRoleProvider") -} - -func TestSessionAssumeRole_WithMFA_NoTokenProvider(t *testing.T) { - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_REGION", "us-east-1") - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "assume_role_w_creds") - - _, err := NewSessionWithOptions(Options{ - Profile: "assume_role_w_mfa", - SharedConfigState: SharedConfigEnable, - }) - assert.Equal(t, err, AssumeRoleTokenProviderNotSetError{}) -} - -func TestSessionAssumeRole_DisableSharedConfig(t *testing.T) { - // Backwards compatibility with Shared config disabled - // assume role should not be built into the config. - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_SDK_LOAD_CONFIG", "0") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "assume_role_w_creds") - - s, err := NewSession() - assert.NoError(t, err) - - creds, err := s.Config.Credentials.Get() - assert.NoError(t, err) - assert.Equal(t, "assume_role_w_creds_akid", creds.AccessKeyID) - assert.Equal(t, "assume_role_w_creds_secret", creds.SecretAccessKey) - assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") -} - -func TestSessionAssumeRole_InvalidSourceProfile(t *testing.T) { - // Backwards compatibility with Shared config disabled - // assume role should not be built into the config. - oldEnv := initSessionTestEnv() - defer awstesting.PopEnv(oldEnv) - - os.Setenv("AWS_SDK_LOAD_CONFIG", "1") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) - os.Setenv("AWS_PROFILE", "assume_role_invalid_source_profile") - - s, err := NewSession() - assert.Error(t, err) - assert.Contains(t, err.Error(), "SharedConfigAssumeRoleError: failed to load assume role") - assert.Nil(t, s) -} - -func initSessionTestEnv() (oldEnv []string) { - oldEnv = awstesting.StashEnv() - os.Setenv("AWS_CONFIG_FILE", "file_not_exists") - os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "file_not_exists") - - return oldEnv -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go deleted file mode 100644 index 09c8e5bc..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go +++ /dev/null @@ -1,295 +0,0 @@ -package session - -import ( - "fmt" - "io/ioutil" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/go-ini/ini" -) - -const ( - // Static Credentials group - accessKeyIDKey = `aws_access_key_id` // group required - secretAccessKey = `aws_secret_access_key` // group required - sessionTokenKey = `aws_session_token` // optional - - // Assume Role Credentials group - roleArnKey = `role_arn` // group required - sourceProfileKey = `source_profile` // group required - externalIDKey = `external_id` // optional - mfaSerialKey = `mfa_serial` // optional - roleSessionNameKey = `role_session_name` // optional - - // Additional Config fields - regionKey = `region` - - // DefaultSharedConfigProfile is the default profile to be used when - // loading configuration from the config files if another profile name - // is not provided. - DefaultSharedConfigProfile = `default` -) - -type assumeRoleConfig struct { - RoleARN string - SourceProfile string - ExternalID string - MFASerial string - RoleSessionName string -} - -// sharedConfig represents the configuration fields of the SDK config files. -type sharedConfig struct { - // Credentials values from the config file. Both aws_access_key_id - // and aws_secret_access_key must be provided together in the same file - // to be considered valid. The values will be ignored if not a complete group. - // aws_session_token is an optional field that can be provided if both of the - // other two fields are also provided. - // - // aws_access_key_id - // aws_secret_access_key - // aws_session_token - Creds credentials.Value - - AssumeRole assumeRoleConfig - AssumeRoleSource *sharedConfig - - // Region is the region the SDK should use for looking up AWS service endpoints - // and signing requests. - // - // region - Region string -} - -type sharedConfigFile struct { - Filename string - IniData *ini.File -} - -// loadSharedConfig retrieves the configuration from the list of files -// using the profile provided. The order the files are listed will determine -// precedence. Values in subsequent files will overwrite values defined in -// earlier files. -// -// For example, given two files A and B. Both define credentials. If the order -// of the files are A then B, B's credential values will be used instead of A's. -// -// See sharedConfig.setFromFile for information how the config files -// will be loaded. -func loadSharedConfig(profile string, filenames []string) (sharedConfig, error) { - if len(profile) == 0 { - profile = DefaultSharedConfigProfile - } - - files, err := loadSharedConfigIniFiles(filenames) - if err != nil { - return sharedConfig{}, err - } - - cfg := sharedConfig{} - if err = cfg.setFromIniFiles(profile, files); err != nil { - return sharedConfig{}, err - } - - if len(cfg.AssumeRole.SourceProfile) > 0 { - if err := cfg.setAssumeRoleSource(profile, files); err != nil { - return sharedConfig{}, err - } - } - - return cfg, nil -} - -func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { - files := make([]sharedConfigFile, 0, len(filenames)) - - for _, filename := range filenames { - b, err := ioutil.ReadFile(filename) - if err != nil { - // Skip files which can't be opened and read for whatever reason - continue - } - - f, err := ini.Load(b) - if err != nil { - return nil, SharedConfigLoadError{Filename: filename, Err: err} - } - - files = append(files, sharedConfigFile{ - Filename: filename, IniData: f, - }) - } - - return files, nil -} - -func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedConfigFile) error { - var assumeRoleSrc sharedConfig - - // Multiple level assume role chains are not support - if cfg.AssumeRole.SourceProfile == origProfile { - assumeRoleSrc = *cfg - assumeRoleSrc.AssumeRole = assumeRoleConfig{} - } else { - err := assumeRoleSrc.setFromIniFiles(cfg.AssumeRole.SourceProfile, files) - if err != nil { - return err - } - } - - if len(assumeRoleSrc.Creds.AccessKeyID) == 0 { - return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} - } - - cfg.AssumeRoleSource = &assumeRoleSrc - - return nil -} - -func (cfg *sharedConfig) setFromIniFiles(profile string, files []sharedConfigFile) error { - // Trim files from the list that don't exist. - for _, f := range files { - if err := cfg.setFromIniFile(profile, f); err != nil { - if _, ok := err.(SharedConfigProfileNotExistsError); ok { - // Ignore proviles missings - continue - } - return err - } - } - - return nil -} - -// setFromFile loads the configuration from the file using -// the profile provided. A sharedConfig pointer type value is used so that -// multiple config file loadings can be chained. -// -// Only loads complete logically grouped values, and will not set fields in cfg -// for incomplete grouped values in the config. Such as credentials. For example -// if a config file only includes aws_access_key_id but no aws_secret_access_key -// the aws_access_key_id will be ignored. -func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) error { - section, err := file.IniData.GetSection(profile) - if err != nil { - // Fallback to to alternate profile name: profile - section, err = file.IniData.GetSection(fmt.Sprintf("profile %s", profile)) - if err != nil { - return SharedConfigProfileNotExistsError{Profile: profile, Err: err} - } - } - - // Shared Credentials - akid := section.Key(accessKeyIDKey).String() - secret := section.Key(secretAccessKey).String() - if len(akid) > 0 && len(secret) > 0 { - cfg.Creds = credentials.Value{ - AccessKeyID: akid, - SecretAccessKey: secret, - SessionToken: section.Key(sessionTokenKey).String(), - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), - } - } - - // Assume Role - roleArn := section.Key(roleArnKey).String() - srcProfile := section.Key(sourceProfileKey).String() - if len(roleArn) > 0 && len(srcProfile) > 0 { - cfg.AssumeRole = assumeRoleConfig{ - RoleARN: roleArn, - SourceProfile: srcProfile, - ExternalID: section.Key(externalIDKey).String(), - MFASerial: section.Key(mfaSerialKey).String(), - RoleSessionName: section.Key(roleSessionNameKey).String(), - } - } - - // Region - if v := section.Key(regionKey).String(); len(v) > 0 { - cfg.Region = v - } - - return nil -} - -// SharedConfigLoadError is an error for the shared config file failed to load. -type SharedConfigLoadError struct { - Filename string - Err error -} - -// Code is the short id of the error. -func (e SharedConfigLoadError) Code() string { - return "SharedConfigLoadError" -} - -// Message is the description of the error -func (e SharedConfigLoadError) Message() string { - return fmt.Sprintf("failed to load config file, %s", e.Filename) -} - -// OrigErr is the underlying error that caused the failure. -func (e SharedConfigLoadError) OrigErr() error { - return e.Err -} - -// Error satisfies the error interface. -func (e SharedConfigLoadError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", e.Err) -} - -// SharedConfigProfileNotExistsError is an error for the shared config when -// the profile was not find in the config file. -type SharedConfigProfileNotExistsError struct { - Profile string - Err error -} - -// Code is the short id of the error. -func (e SharedConfigProfileNotExistsError) Code() string { - return "SharedConfigProfileNotExistsError" -} - -// Message is the description of the error -func (e SharedConfigProfileNotExistsError) Message() string { - return fmt.Sprintf("failed to get profile, %s", e.Profile) -} - -// OrigErr is the underlying error that caused the failure. -func (e SharedConfigProfileNotExistsError) OrigErr() error { - return e.Err -} - -// Error satisfies the error interface. -func (e SharedConfigProfileNotExistsError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", e.Err) -} - -// SharedConfigAssumeRoleError is an error for the shared config when the -// profile contains assume role information, but that information is invalid -// or not complete. -type SharedConfigAssumeRoleError struct { - RoleARN string -} - -// Code is the short id of the error. -func (e SharedConfigAssumeRoleError) Code() string { - return "SharedConfigAssumeRoleError" -} - -// Message is the description of the error -func (e SharedConfigAssumeRoleError) Message() string { - return fmt.Sprintf("failed to load assume role for %s, source profile has no shared credentials", - e.RoleARN) -} - -// OrigErr is the underlying error that caused the failure. -func (e SharedConfigAssumeRoleError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e SharedConfigAssumeRoleError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go deleted file mode 100644 index 3a07b8d9..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config_test.go +++ /dev/null @@ -1,274 +0,0 @@ -package session - -import ( - "fmt" - "path/filepath" - "testing" - - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/go-ini/ini" - "github.com/stretchr/testify/assert" -) - -var ( - testConfigFilename = filepath.Join("testdata", "shared_config") - testConfigOtherFilename = filepath.Join("testdata", "shared_config_other") -) - -func TestLoadSharedConfig(t *testing.T) { - cases := []struct { - Filenames []string - Profile string - Expected sharedConfig - Err error - }{ - { - Filenames: []string{"file_not_exists"}, - Profile: "default", - }, - { - Filenames: []string{testConfigFilename}, - Expected: sharedConfig{ - Region: "default_region", - }, - }, - { - Filenames: []string{testConfigOtherFilename, testConfigFilename}, - Profile: "config_file_load_order", - Expected: sharedConfig{ - Region: "shared_config_region", - Creds: credentials.Value{ - AccessKeyID: "shared_config_akid", - SecretAccessKey: "shared_config_secret", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), - }, - }, - }, - { - Filenames: []string{testConfigFilename, testConfigOtherFilename}, - Profile: "config_file_load_order", - Expected: sharedConfig{ - Region: "shared_config_other_region", - Creds: credentials.Value{ - AccessKeyID: "shared_config_other_akid", - SecretAccessKey: "shared_config_other_secret", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigOtherFilename), - }, - }, - }, - { - Filenames: []string{testConfigOtherFilename, testConfigFilename}, - Profile: "assume_role", - Expected: sharedConfig{ - AssumeRole: assumeRoleConfig{ - RoleARN: "assume_role_role_arn", - SourceProfile: "complete_creds", - }, - AssumeRoleSource: &sharedConfig{ - Creds: credentials.Value{ - AccessKeyID: "complete_creds_akid", - SecretAccessKey: "complete_creds_secret", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), - }, - }, - }, - }, - { - Filenames: []string{testConfigOtherFilename, testConfigFilename}, - Profile: "assume_role_invalid_source_profile", - Expected: sharedConfig{ - AssumeRole: assumeRoleConfig{ - RoleARN: "assume_role_invalid_source_profile_role_arn", - SourceProfile: "profile_not_exists", - }, - }, - Err: SharedConfigAssumeRoleError{RoleARN: "assume_role_invalid_source_profile_role_arn"}, - }, - { - Filenames: []string{testConfigOtherFilename, testConfigFilename}, - Profile: "assume_role_w_creds", - Expected: sharedConfig{ - Creds: credentials.Value{ - AccessKeyID: "assume_role_w_creds_akid", - SecretAccessKey: "assume_role_w_creds_secret", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), - }, - AssumeRole: assumeRoleConfig{ - RoleARN: "assume_role_w_creds_role_arn", - SourceProfile: "assume_role_w_creds", - ExternalID: "1234", - RoleSessionName: "assume_role_w_creds_session_name", - }, - AssumeRoleSource: &sharedConfig{ - Creds: credentials.Value{ - AccessKeyID: "assume_role_w_creds_akid", - SecretAccessKey: "assume_role_w_creds_secret", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), - }, - }, - }, - }, - { - Filenames: []string{testConfigOtherFilename, testConfigFilename}, - Profile: "assume_role_wo_creds", - Expected: sharedConfig{ - AssumeRole: assumeRoleConfig{ - RoleARN: "assume_role_wo_creds_role_arn", - SourceProfile: "assume_role_wo_creds", - }, - }, - Err: SharedConfigAssumeRoleError{RoleARN: "assume_role_wo_creds_role_arn"}, - }, - { - Filenames: []string{filepath.Join("testdata", "shared_config_invalid_ini")}, - Profile: "profile_name", - Err: SharedConfigLoadError{Filename: filepath.Join("testdata", "shared_config_invalid_ini")}, - }, - } - - for i, c := range cases { - cfg, err := loadSharedConfig(c.Profile, c.Filenames) - if c.Err != nil { - assert.Contains(t, err.Error(), c.Err.Error(), "expected error, %d", i) - continue - } - - assert.NoError(t, err, "unexpected error, %d", i) - assert.Equal(t, c.Expected, cfg, "not equal, %d", i) - } -} - -func TestLoadSharedConfigFromFile(t *testing.T) { - filename := testConfigFilename - f, err := ini.Load(filename) - if err != nil { - t.Fatalf("failed to load test config file, %s, %v", filename, err) - } - iniFile := sharedConfigFile{IniData: f, Filename: filename} - - cases := []struct { - Profile string - Expected sharedConfig - Err error - }{ - { - Profile: "default", - Expected: sharedConfig{Region: "default_region"}, - }, - { - Profile: "alt_profile_name", - Expected: sharedConfig{Region: "alt_profile_name_region"}, - }, - { - Profile: "short_profile_name_first", - Expected: sharedConfig{Region: "short_profile_name_first_short"}, - }, - { - Profile: "partial_creds", - Expected: sharedConfig{}, - }, - { - Profile: "complete_creds", - Expected: sharedConfig{ - Creds: credentials.Value{ - AccessKeyID: "complete_creds_akid", - SecretAccessKey: "complete_creds_secret", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), - }, - }, - }, - { - Profile: "complete_creds_with_token", - Expected: sharedConfig{ - Creds: credentials.Value{ - AccessKeyID: "complete_creds_with_token_akid", - SecretAccessKey: "complete_creds_with_token_secret", - SessionToken: "complete_creds_with_token_token", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), - }, - }, - }, - { - Profile: "full_profile", - Expected: sharedConfig{ - Creds: credentials.Value{ - AccessKeyID: "full_profile_akid", - SecretAccessKey: "full_profile_secret", - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", testConfigFilename), - }, - Region: "full_profile_region", - }, - }, - { - Profile: "partial_assume_role", - Expected: sharedConfig{}, - }, - { - Profile: "assume_role", - Expected: sharedConfig{ - AssumeRole: assumeRoleConfig{ - RoleARN: "assume_role_role_arn", - SourceProfile: "complete_creds", - }, - }, - }, - { - Profile: "assume_role_w_mfa", - Expected: sharedConfig{ - AssumeRole: assumeRoleConfig{ - RoleARN: "assume_role_role_arn", - SourceProfile: "complete_creds", - MFASerial: "0123456789", - }, - }, - }, - { - Profile: "does_not_exists", - Err: SharedConfigProfileNotExistsError{Profile: "does_not_exists"}, - }, - } - - for i, c := range cases { - cfg := sharedConfig{} - - err := cfg.setFromIniFile(c.Profile, iniFile) - if c.Err != nil { - assert.Contains(t, err.Error(), c.Err.Error(), "expected error, %d", i) - continue - } - - assert.NoError(t, err, "unexpected error, %d", i) - assert.Equal(t, c.Expected, cfg, "not equal, %d", i) - } -} - -func TestLoadSharedConfigIniFiles(t *testing.T) { - cases := []struct { - Filenames []string - Expected []sharedConfigFile - }{ - { - Filenames: []string{"not_exists", testConfigFilename}, - Expected: []sharedConfigFile{ - {Filename: testConfigFilename}, - }, - }, - { - Filenames: []string{testConfigFilename, testConfigOtherFilename}, - Expected: []sharedConfigFile{ - {Filename: testConfigFilename}, - {Filename: testConfigOtherFilename}, - }, - }, - } - - for i, c := range cases { - files, err := loadSharedConfigIniFiles(c.Filenames) - assert.NoError(t, err, "unexpected error, %d", i) - assert.Equal(t, len(c.Expected), len(files), "expected num files, %d", i) - - for i, expectedFile := range c.Expected { - assert.Equal(t, expectedFile.Filename, files[i].Filename) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go deleted file mode 100644 index 2e591c27..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_1_5_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// +build go1.5 - -package v4_test - -import ( - "fmt" - "net/http" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting/unit" -) - -func TestStandaloneSign(t *testing.T) { - creds := unit.Session.Config.Credentials - signer := v4.NewSigner(creds) - - for _, c := range standaloneSignCases { - host := fmt.Sprintf("https://%s.%s.%s.amazonaws.com", - c.SubDomain, c.Region, c.Service) - - req, err := http.NewRequest("GET", host, nil) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - // URL.EscapedPath() will be used by the signer to get the - // escaped form of the request's URI path. - req.URL.Path = c.OrigURI - req.URL.RawQuery = c.OrigQuery - - _, err = signer.Sign(req, nil, c.Service, c.Region, time.Unix(0, 0)) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - actual := req.Header.Get("Authorization") - if e, a := c.ExpSig, actual; e != a { - t.Errorf("expected %v, but recieved %v", e, a) - } - if e, a := c.OrigURI, req.URL.Path; e != a { - t.Errorf("expected %v, but recieved %v", e, a) - } - if e, a := c.EscapedURI, req.URL.EscapedPath(); e != a { - t.Errorf("expected %v, but recieved %v", e, a) - } - } -} - -func TestStandaloneSign_RawPath(t *testing.T) { - creds := unit.Session.Config.Credentials - signer := v4.NewSigner(creds) - - for _, c := range standaloneSignCases { - host := fmt.Sprintf("https://%s.%s.%s.amazonaws.com", - c.SubDomain, c.Region, c.Service) - - req, err := http.NewRequest("GET", host, nil) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - // URL.EscapedPath() will be used by the signer to get the - // escaped form of the request's URI path. - req.URL.Path = c.OrigURI - req.URL.RawPath = c.EscapedURI - req.URL.RawQuery = c.OrigQuery - - _, err = signer.Sign(req, nil, c.Service, c.Region, time.Unix(0, 0)) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - actual := req.Header.Get("Authorization") - if e, a := c.ExpSig, actual; e != a { - t.Errorf("expected %v, but recieved %v", e, a) - } - if e, a := c.OrigURI, req.URL.Path; e != a { - t.Errorf("expected %v, but recieved %v", e, a) - } - if e, a := c.EscapedURI, req.URL.EscapedPath(); e != a { - t.Errorf("expected %v, but recieved %v", e, a) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go deleted file mode 100644 index c5341a93..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go +++ /dev/null @@ -1,166 +0,0 @@ -package v4_test - -import ( - "net/http" - "net/url" - "reflect" - "strings" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -var standaloneSignCases = []struct { - OrigURI string - OrigQuery string - Region, Service, SubDomain string - ExpSig string - EscapedURI string -}{ - { - OrigURI: `/logs-*/_search`, - OrigQuery: `pretty=true`, - Region: "us-west-2", Service: "es", SubDomain: "hostname-clusterkey", - EscapedURI: `/logs-%2A/_search`, - ExpSig: `AWS4-HMAC-SHA256 Credential=AKID/19700101/us-west-2/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=79d0760751907af16f64a537c1242416dacf51204a7dd5284492d15577973b91`, - }, -} - -func TestPresignHandler(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - ContentDisposition: aws.String("a+b c$d"), - ACL: aws.String("public-read"), - }) - req.Time = time.Unix(0, 0) - urlstr, err := req.Presign(5 * time.Minute) - - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - expectedHost := "bucket.s3.mock-region.amazonaws.com" - expectedDate := "19700101T000000Z" - expectedHeaders := "content-disposition;host;x-amz-acl" - expectedSig := "a46583256431b09eb45ba4af2e6286d96a9835ed13721023dc8076dfdcb90fcb" - expectedCred := "AKID/19700101/mock-region/s3/aws4_request" - - u, _ := url.Parse(urlstr) - urlQ := u.Query() - if e, a := expectedHost, u.Host; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedSig, urlQ.Get("X-Amz-Signature"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedCred, urlQ.Get("X-Amz-Credential"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedHeaders, urlQ.Get("X-Amz-SignedHeaders"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedDate, urlQ.Get("X-Amz-Date"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "300", urlQ.Get("X-Amz-Expires"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "UNSIGNED-PAYLOAD", urlQ.Get("X-Amz-Content-Sha256"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - if e, a := "+", urlstr; strings.Contains(a, e) { // + encoded as %20 - t.Errorf("expect %v not to be in %v", e, a) - } -} - -func TestPresignRequest(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("key"), - ContentDisposition: aws.String("a+b c$d"), - ACL: aws.String("public-read"), - }) - req.Time = time.Unix(0, 0) - urlstr, headers, err := req.PresignRequest(5 * time.Minute) - - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - expectedHost := "bucket.s3.mock-region.amazonaws.com" - expectedDate := "19700101T000000Z" - expectedHeaders := "content-disposition;host;x-amz-acl" - expectedSig := "a46583256431b09eb45ba4af2e6286d96a9835ed13721023dc8076dfdcb90fcb" - expectedCred := "AKID/19700101/mock-region/s3/aws4_request" - expectedHeaderMap := http.Header{ - "x-amz-acl": []string{"public-read"}, - "content-disposition": []string{"a+b c$d"}, - } - - u, _ := url.Parse(urlstr) - urlQ := u.Query() - if e, a := expectedHost, u.Host; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedSig, urlQ.Get("X-Amz-Signature"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedCred, urlQ.Get("X-Amz-Credential"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedHeaders, urlQ.Get("X-Amz-SignedHeaders"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedDate, urlQ.Get("X-Amz-Date"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedHeaderMap, headers; !reflect.DeepEqual(e, a) { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "300", urlQ.Get("X-Amz-Expires"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "UNSIGNED-PAYLOAD", urlQ.Get("X-Amz-Content-Sha256"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - if e, a := "+", urlstr; strings.Contains(a, e) { // + encoded as %20 - t.Errorf("expect %v not to be in %v", e, a) - } -} - -func TestStandaloneSign_CustomURIEscape(t *testing.T) { - var expectSig = `AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=6601e883cc6d23871fd6c2a394c5677ea2b8c82b04a6446786d64cd74f520967` - - creds := unit.Session.Config.Credentials - signer := v4.NewSigner(creds, func(s *v4.Signer) { - s.DisableURIPathEscaping = true - }) - - host := "https://subdomain.us-east-1.es.amazonaws.com" - req, err := http.NewRequest("GET", host, nil) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - req.URL.Path = `/log-*/_search` - req.URL.Opaque = "//subdomain.us-east-1.es.amazonaws.com/log-%2A/_search" - - _, err = signer.Sign(req, nil, "es", "us-east-1", time.Unix(0, 0)) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - actual := req.Header.Get("Authorization") - if e, a := expectSig, actual; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go deleted file mode 100644 index 244c86da..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go +++ /dev/null @@ -1,82 +0,0 @@ -package v4 - -import ( - "net/http" - "strings" -) - -// validator houses a set of rule needed for validation of a -// string value -type rules []rule - -// rule interface allows for more flexible rules and just simply -// checks whether or not a value adheres to that rule -type rule interface { - IsValid(value string) bool -} - -// IsValid will iterate through all rules and see if any rules -// apply to the value and supports nested rules -func (r rules) IsValid(value string) bool { - for _, rule := range r { - if rule.IsValid(value) { - return true - } - } - return false -} - -// mapRule generic rule for maps -type mapRule map[string]struct{} - -// IsValid for the map rule satisfies whether it exists in the map -func (m mapRule) IsValid(value string) bool { - _, ok := m[value] - return ok -} - -// whitelist is a generic rule for whitelisting -type whitelist struct { - rule -} - -// IsValid for whitelist checks if the value is within the whitelist -func (w whitelist) IsValid(value string) bool { - return w.rule.IsValid(value) -} - -// blacklist is a generic rule for blacklisting -type blacklist struct { - rule -} - -// IsValid for whitelist checks if the value is within the whitelist -func (b blacklist) IsValid(value string) bool { - return !b.rule.IsValid(value) -} - -type patterns []string - -// IsValid for patterns checks each pattern and returns if a match has -// been found -func (p patterns) IsValid(value string) bool { - for _, pattern := range p { - if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) { - return true - } - } - return false -} - -// inclusiveRules rules allow for rules to depend on one another -type inclusiveRules []rule - -// IsValid will return true if all rules are true -func (r inclusiveRules) IsValid(value string) bool { - for _, rule := range r { - if !rule.IsValid(value) { - return false - } - } - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules_test.go deleted file mode 100644 index f4be951a..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package v4 - -import ( - "testing" -) - -func TestRuleCheckWhitelist(t *testing.T) { - w := whitelist{ - mapRule{ - "Cache-Control": struct{}{}, - }, - } - - if !w.IsValid("Cache-Control") { - t.Error("expected true value") - } - if w.IsValid("Cache-") { - t.Error("expected false value") - } -} - -func TestRuleCheckBlacklist(t *testing.T) { - b := blacklist{ - mapRule{ - "Cache-Control": struct{}{}, - }, - } - - if b.IsValid("Cache-Control") { - t.Error("expected false value") - } - if !b.IsValid("Cache-") { - t.Error("expected true value") - } -} - -func TestRuleCheckPattern(t *testing.T) { - p := patterns{"X-Amz-Meta-"} - - if !p.IsValid("X-Amz-Meta-") { - t.Error("expected true value") - } - if !p.IsValid("X-Amz-Meta-Star") { - t.Error("expected true value") - } - if p.IsValid("Cache-") { - t.Error("expected false value") - } -} - -func TestRuleComplexWhitelist(t *testing.T) { - w := rules{ - whitelist{ - mapRule{ - "Cache-Control": struct{}{}, - }, - }, - patterns{"X-Amz-Meta-"}, - } - - r := rules{ - inclusiveRules{patterns{"X-Amz-"}, blacklist{w}}, - } - - if !r.IsValid("X-Amz-Blah") { - t.Error("expected true value") - } - if r.IsValid("X-Amz-Meta-") { - t.Error("expected false value") - } - if r.IsValid("X-Amz-Meta-Star") { - t.Error("expected false value") - } - if r.IsValid("Cache-Control") { - t.Error("expected false value") - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go deleted file mode 100644 index 6aa2ed24..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go +++ /dev/null @@ -1,7 +0,0 @@ -package v4 - -// WithUnsignedPayload will enable and set the UnsignedPayload field to -// true of the signer. -func WithUnsignedPayload(v4 *Signer) { - v4.UnsignedPayload = true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go deleted file mode 100644 index bd082e9d..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build go1.5 - -package v4 - -import ( - "net/url" - "strings" -) - -func getURIPath(u *url.URL) string { - var uri string - - if len(u.Opaque) > 0 { - uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") - } else { - uri = u.EscapedPath() - } - - if len(uri) == 0 { - uri = "/" - } - - return uri -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go deleted file mode 100644 index 15da5724..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ /dev/null @@ -1,762 +0,0 @@ -// Package v4 implements signing for AWS V4 signer -// -// Provides request signing for request that need to be signed with -// AWS V4 Signatures. -// -// Standalone Signer -// -// Generally using the signer outside of the SDK should not require any additional -// logic when using Go v1.5 or higher. The signer does this by taking advantage -// of the URL.EscapedPath method. If your request URI requires additional escaping -// you many need to use the URL.Opaque to define what the raw URI should be sent -// to the service as. -// -// The signer will first check the URL.Opaque field, and use its value if set. -// The signer does require the URL.Opaque field to be set in the form of: -// -// "///" -// -// // e.g. -// "//example.com/some/path" -// -// The leading "//" and hostname are required or the URL.Opaque escaping will -// not work correctly. -// -// If URL.Opaque is not set the signer will fallback to the URL.EscapedPath() -// method and using the returned value. If you're using Go v1.4 you must set -// URL.Opaque if the URI path needs escaping. If URL.Opaque is not set with -// Go v1.5 the signer will fallback to URL.Path. -// -// AWS v4 signature validation requires that the canonical string's URI path -// element must be the URI escaped form of the HTTP request's path. -// http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html -// -// The Go HTTP client will perform escaping automatically on the request. Some -// of these escaping may cause signature validation errors because the HTTP -// request differs from the URI path or query that the signature was generated. -// https://golang.org/pkg/net/url/#URL.EscapedPath -// -// Because of this, it is recommended that when using the signer outside of the -// SDK that explicitly escaping the request prior to being signed is preferable, -// and will help prevent signature validation errors. This can be done by setting -// the URL.Opaque or URL.RawPath. The SDK will use URL.Opaque first and then -// call URL.EscapedPath() if Opaque is not set. -// -// If signing a request intended for HTTP2 server, and you're using Go 1.6.2 -// through 1.7.4 you should use the URL.RawPath as the pre-escaped form of the -// request URL. https://github.com/golang/go/issues/16847 points to a bug in -// Go pre 1.8 that fails to make HTTP2 requests using absolute URL in the HTTP -// message. URL.Opaque generally will force Go to make requests with absolute URL. -// URL.RawPath does not do this, but RawPath must be a valid escaping of Path -// or url.EscapedPath will ignore the RawPath escaping. -// -// Test `TestStandaloneSign` provides a complete example of using the signer -// outside of the SDK and pre-escaping the URI path. -package v4 - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/hex" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "sort" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -const ( - authHeaderPrefix = "AWS4-HMAC-SHA256" - timeFormat = "20060102T150405Z" - shortTimeFormat = "20060102" - - // emptyStringSHA256 is a SHA256 of an empty string - emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` -) - -var ignoredHeaders = rules{ - blacklist{ - mapRule{ - "Authorization": struct{}{}, - "User-Agent": struct{}{}, - "X-Amzn-Trace-Id": struct{}{}, - }, - }, -} - -// requiredSignedHeaders is a whitelist for build canonical headers. -var requiredSignedHeaders = rules{ - whitelist{ - mapRule{ - "Cache-Control": struct{}{}, - "Content-Disposition": struct{}{}, - "Content-Encoding": struct{}{}, - "Content-Language": struct{}{}, - "Content-Md5": struct{}{}, - "Content-Type": struct{}{}, - "Expires": struct{}{}, - "If-Match": struct{}{}, - "If-Modified-Since": struct{}{}, - "If-None-Match": struct{}{}, - "If-Unmodified-Since": struct{}{}, - "Range": struct{}{}, - "X-Amz-Acl": struct{}{}, - "X-Amz-Copy-Source": struct{}{}, - "X-Amz-Copy-Source-If-Match": struct{}{}, - "X-Amz-Copy-Source-If-Modified-Since": struct{}{}, - "X-Amz-Copy-Source-If-None-Match": struct{}{}, - "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{}, - "X-Amz-Copy-Source-Range": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, - "X-Amz-Grant-Full-control": struct{}{}, - "X-Amz-Grant-Read": struct{}{}, - "X-Amz-Grant-Read-Acp": struct{}{}, - "X-Amz-Grant-Write": struct{}{}, - "X-Amz-Grant-Write-Acp": struct{}{}, - "X-Amz-Metadata-Directive": struct{}{}, - "X-Amz-Mfa": struct{}{}, - "X-Amz-Request-Payer": struct{}{}, - "X-Amz-Server-Side-Encryption": struct{}{}, - "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, - "X-Amz-Storage-Class": struct{}{}, - "X-Amz-Website-Redirect-Location": struct{}{}, - }, - }, - patterns{"X-Amz-Meta-"}, -} - -// allowedHoisting is a whitelist for build query headers. The boolean value -// represents whether or not it is a pattern. -var allowedQueryHoisting = inclusiveRules{ - blacklist{requiredSignedHeaders}, - patterns{"X-Amz-"}, -} - -// Signer applies AWS v4 signing to given request. Use this to sign requests -// that need to be signed with AWS V4 Signatures. -type Signer struct { - // The authentication credentials the request will be signed against. - // This value must be set to sign requests. - Credentials *credentials.Credentials - - // Sets the log level the signer should use when reporting information to - // the logger. If the logger is nil nothing will be logged. See - // aws.LogLevelType for more information on available logging levels - // - // By default nothing will be logged. - Debug aws.LogLevelType - - // The logger loging information will be written to. If there the logger - // is nil, nothing will be logged. - Logger aws.Logger - - // Disables the Signer's moving HTTP header key/value pairs from the HTTP - // request header to the request's query string. This is most commonly used - // with pre-signed requests preventing headers from being added to the - // request's query string. - DisableHeaderHoisting bool - - // Disables the automatic escaping of the URI path of the request for the - // siganture's canonical string's path. For services that do not need additional - // escaping then use this to disable the signer escaping the path. - // - // S3 is an example of a service that does not need additional escaping. - // - // http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html - DisableURIPathEscaping bool - - // Disales the automatical setting of the HTTP request's Body field with the - // io.ReadSeeker passed in to the signer. This is useful if you're using a - // custom wrapper around the body for the io.ReadSeeker and want to preserve - // the Body value on the Request.Body. - // - // This does run the risk of signing a request with a body that will not be - // sent in the request. Need to ensure that the underlying data of the Body - // values are the same. - DisableRequestBodyOverwrite bool - - // currentTimeFn returns the time value which represents the current time. - // This value should only be used for testing. If it is nil the default - // time.Now will be used. - currentTimeFn func() time.Time - - // UnsignedPayload will prevent signing of the payload. This will only - // work for services that have support for this. - UnsignedPayload bool -} - -// NewSigner returns a Signer pointer configured with the credentials and optional -// option values provided. If not options are provided the Signer will use its -// default configuration. -func NewSigner(credentials *credentials.Credentials, options ...func(*Signer)) *Signer { - v4 := &Signer{ - Credentials: credentials, - } - - for _, option := range options { - option(v4) - } - - return v4 -} - -type signingCtx struct { - ServiceName string - Region string - Request *http.Request - Body io.ReadSeeker - Query url.Values - Time time.Time - ExpireTime time.Duration - SignedHeaderVals http.Header - - DisableURIPathEscaping bool - - credValues credentials.Value - isPresign bool - formattedTime string - formattedShortTime string - unsignedPayload bool - - bodyDigest string - signedHeaders string - canonicalHeaders string - canonicalString string - credentialString string - stringToSign string - signature string - authorization string -} - -// Sign signs AWS v4 requests with the provided body, service name, region the -// request is made to, and time the request is signed at. The signTime allows -// you to specify that a request is signed for the future, and cannot be -// used until then. -// -// Returns a list of HTTP headers that were included in the signature or an -// error if signing the request failed. Generally for signed requests this value -// is not needed as the full request context will be captured by the http.Request -// value. It is included for reference though. -// -// Sign will set the request's Body to be the `body` parameter passed in. If -// the body is not already an io.ReadCloser, it will be wrapped within one. If -// a `nil` body parameter passed to Sign, the request's Body field will be -// also set to nil. Its important to note that this functionality will not -// change the request's ContentLength of the request. -// -// Sign differs from Presign in that it will sign the request using HTTP -// header values. This type of signing is intended for http.Request values that -// will not be shared, or are shared in a way the header values on the request -// will not be lost. -// -// The requests body is an io.ReadSeeker so the SHA256 of the body can be -// generated. To bypass the signer computing the hash you can set the -// "X-Amz-Content-Sha256" header with a precomputed value. The signer will -// only compute the hash if the request header value is empty. -func (v4 Signer) Sign(r *http.Request, body io.ReadSeeker, service, region string, signTime time.Time) (http.Header, error) { - return v4.signWithBody(r, body, service, region, 0, signTime) -} - -// Presign signs AWS v4 requests with the provided body, service name, region -// the request is made to, and time the request is signed at. The signTime -// allows you to specify that a request is signed for the future, and cannot -// be used until then. -// -// Returns a list of HTTP headers that were included in the signature or an -// error if signing the request failed. For presigned requests these headers -// and their values must be included on the HTTP request when it is made. This -// is helpful to know what header values need to be shared with the party the -// presigned request will be distributed to. -// -// Presign differs from Sign in that it will sign the request using query string -// instead of header values. This allows you to share the Presigned Request's -// URL with third parties, or distribute it throughout your system with minimal -// dependencies. -// -// Presign also takes an exp value which is the duration the -// signed request will be valid after the signing time. This is allows you to -// set when the request will expire. -// -// The requests body is an io.ReadSeeker so the SHA256 of the body can be -// generated. To bypass the signer computing the hash you can set the -// "X-Amz-Content-Sha256" header with a precomputed value. The signer will -// only compute the hash if the request header value is empty. -// -// Presigning a S3 request will not compute the body's SHA256 hash by default. -// This is done due to the general use case for S3 presigned URLs is to share -// PUT/GET capabilities. If you would like to include the body's SHA256 in the -// presigned request's signature you can set the "X-Amz-Content-Sha256" -// HTTP header and that will be included in the request's signature. -func (v4 Signer) Presign(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, signTime time.Time) (http.Header, error) { - return v4.signWithBody(r, body, service, region, exp, signTime) -} - -func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, signTime time.Time) (http.Header, error) { - currentTimeFn := v4.currentTimeFn - if currentTimeFn == nil { - currentTimeFn = time.Now - } - - ctx := &signingCtx{ - Request: r, - Body: body, - Query: r.URL.Query(), - Time: signTime, - ExpireTime: exp, - isPresign: exp != 0, - ServiceName: service, - Region: region, - DisableURIPathEscaping: v4.DisableURIPathEscaping, - unsignedPayload: v4.UnsignedPayload, - } - - for key := range ctx.Query { - sort.Strings(ctx.Query[key]) - } - - if ctx.isRequestSigned() { - ctx.Time = currentTimeFn() - ctx.handlePresignRemoval() - } - - var err error - ctx.credValues, err = v4.Credentials.Get() - if err != nil { - return http.Header{}, err - } - - ctx.assignAmzQueryValues() - ctx.build(v4.DisableHeaderHoisting) - - // If the request is not presigned the body should be attached to it. This - // prevents the confusion of wanting to send a signed request without - // the body the request was signed for attached. - if !(v4.DisableRequestBodyOverwrite || ctx.isPresign) { - var reader io.ReadCloser - if body != nil { - var ok bool - if reader, ok = body.(io.ReadCloser); !ok { - reader = ioutil.NopCloser(body) - } - } - r.Body = reader - } - - if v4.Debug.Matches(aws.LogDebugWithSigning) { - v4.logSigningInfo(ctx) - } - - return ctx.SignedHeaderVals, nil -} - -func (ctx *signingCtx) handlePresignRemoval() { - if !ctx.isPresign { - return - } - - // The credentials have expired for this request. The current signing - // is invalid, and needs to be request because the request will fail. - ctx.removePresign() - - // Update the request's query string to ensure the values stays in - // sync in the case retrieving the new credentials fails. - ctx.Request.URL.RawQuery = ctx.Query.Encode() -} - -func (ctx *signingCtx) assignAmzQueryValues() { - if ctx.isPresign { - ctx.Query.Set("X-Amz-Algorithm", authHeaderPrefix) - if ctx.credValues.SessionToken != "" { - ctx.Query.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) - } else { - ctx.Query.Del("X-Amz-Security-Token") - } - - return - } - - if ctx.credValues.SessionToken != "" { - ctx.Request.Header.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) - } -} - -// SignRequestHandler is a named request handler the SDK will use to sign -// service client request with using the V4 signature. -var SignRequestHandler = request.NamedHandler{ - Name: "v4.SignRequestHandler", Fn: SignSDKRequest, -} - -// SignSDKRequest signs an AWS request with the V4 signature. This -// request handler should only be used with the SDK's built in service client's -// API operation requests. -// -// This function should not be used on its on its own, but in conjunction with -// an AWS service client's API operation call. To sign a standalone request -// not created by a service client's API operation method use the "Sign" or -// "Presign" functions of the "Signer" type. -// -// If the credentials of the request's config are set to -// credentials.AnonymousCredentials the request will not be signed. -func SignSDKRequest(req *request.Request) { - signSDKRequestWithCurrTime(req, time.Now) -} - -// BuildNamedHandler will build a generic handler for signing. -func BuildNamedHandler(name string, opts ...func(*Signer)) request.NamedHandler { - return request.NamedHandler{ - Name: name, - Fn: func(req *request.Request) { - signSDKRequestWithCurrTime(req, time.Now, opts...) - }, - } -} - -func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time, opts ...func(*Signer)) { - // If the request does not need to be signed ignore the signing of the - // request if the AnonymousCredentials object is used. - if req.Config.Credentials == credentials.AnonymousCredentials { - return - } - - region := req.ClientInfo.SigningRegion - if region == "" { - region = aws.StringValue(req.Config.Region) - } - - name := req.ClientInfo.SigningName - if name == "" { - name = req.ClientInfo.ServiceName - } - - v4 := NewSigner(req.Config.Credentials, func(v4 *Signer) { - v4.Debug = req.Config.LogLevel.Value() - v4.Logger = req.Config.Logger - v4.DisableHeaderHoisting = req.NotHoist - v4.currentTimeFn = curTimeFn - if name == "s3" { - // S3 service should not have any escaping applied - v4.DisableURIPathEscaping = true - } - // Prevents setting the HTTPRequest's Body. Since the Body could be - // wrapped in a custom io.Closer that we do not want to be stompped - // on top of by the signer. - v4.DisableRequestBodyOverwrite = true - }) - - for _, opt := range opts { - opt(v4) - } - - signingTime := req.Time - if !req.LastSignedAt.IsZero() { - signingTime = req.LastSignedAt - } - - signedHeaders, err := v4.signWithBody(req.HTTPRequest, req.GetBody(), - name, region, req.ExpireTime, signingTime, - ) - if err != nil { - req.Error = err - req.SignedHeaderVals = nil - return - } - - req.SignedHeaderVals = signedHeaders - req.LastSignedAt = curTimeFn() -} - -const logSignInfoMsg = `DEBUG: Request Signature: ----[ CANONICAL STRING ]----------------------------- -%s ----[ STRING TO SIGN ]-------------------------------- -%s%s ------------------------------------------------------` -const logSignedURLMsg = ` ----[ SIGNED URL ]------------------------------------ -%s` - -func (v4 *Signer) logSigningInfo(ctx *signingCtx) { - signedURLMsg := "" - if ctx.isPresign { - signedURLMsg = fmt.Sprintf(logSignedURLMsg, ctx.Request.URL.String()) - } - msg := fmt.Sprintf(logSignInfoMsg, ctx.canonicalString, ctx.stringToSign, signedURLMsg) - v4.Logger.Log(msg) -} - -func (ctx *signingCtx) build(disableHeaderHoisting bool) { - ctx.buildTime() // no depends - ctx.buildCredentialString() // no depends - - ctx.buildBodyDigest() - - unsignedHeaders := ctx.Request.Header - if ctx.isPresign { - if !disableHeaderHoisting { - urlValues := url.Values{} - urlValues, unsignedHeaders = buildQuery(allowedQueryHoisting, unsignedHeaders) // no depends - for k := range urlValues { - ctx.Query[k] = urlValues[k] - } - } - } - - ctx.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) - ctx.buildCanonicalString() // depends on canon headers / signed headers - ctx.buildStringToSign() // depends on canon string - ctx.buildSignature() // depends on string to sign - - if ctx.isPresign { - ctx.Request.URL.RawQuery += "&X-Amz-Signature=" + ctx.signature - } else { - parts := []string{ - authHeaderPrefix + " Credential=" + ctx.credValues.AccessKeyID + "/" + ctx.credentialString, - "SignedHeaders=" + ctx.signedHeaders, - "Signature=" + ctx.signature, - } - ctx.Request.Header.Set("Authorization", strings.Join(parts, ", ")) - } -} - -func (ctx *signingCtx) buildTime() { - ctx.formattedTime = ctx.Time.UTC().Format(timeFormat) - ctx.formattedShortTime = ctx.Time.UTC().Format(shortTimeFormat) - - if ctx.isPresign { - duration := int64(ctx.ExpireTime / time.Second) - ctx.Query.Set("X-Amz-Date", ctx.formattedTime) - ctx.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10)) - } else { - ctx.Request.Header.Set("X-Amz-Date", ctx.formattedTime) - } -} - -func (ctx *signingCtx) buildCredentialString() { - ctx.credentialString = strings.Join([]string{ - ctx.formattedShortTime, - ctx.Region, - ctx.ServiceName, - "aws4_request", - }, "/") - - if ctx.isPresign { - ctx.Query.Set("X-Amz-Credential", ctx.credValues.AccessKeyID+"/"+ctx.credentialString) - } -} - -func buildQuery(r rule, header http.Header) (url.Values, http.Header) { - query := url.Values{} - unsignedHeaders := http.Header{} - for k, h := range header { - if r.IsValid(k) { - query[k] = h - } else { - unsignedHeaders[k] = h - } - } - - return query, unsignedHeaders -} -func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) { - var headers []string - headers = append(headers, "host") - for k, v := range header { - canonicalKey := http.CanonicalHeaderKey(k) - if !r.IsValid(canonicalKey) { - continue // ignored header - } - if ctx.SignedHeaderVals == nil { - ctx.SignedHeaderVals = make(http.Header) - } - - lowerCaseKey := strings.ToLower(k) - if _, ok := ctx.SignedHeaderVals[lowerCaseKey]; ok { - // include additional values - ctx.SignedHeaderVals[lowerCaseKey] = append(ctx.SignedHeaderVals[lowerCaseKey], v...) - continue - } - - headers = append(headers, lowerCaseKey) - ctx.SignedHeaderVals[lowerCaseKey] = v - } - sort.Strings(headers) - - ctx.signedHeaders = strings.Join(headers, ";") - - if ctx.isPresign { - ctx.Query.Set("X-Amz-SignedHeaders", ctx.signedHeaders) - } - - headerValues := make([]string, len(headers)) - for i, k := range headers { - if k == "host" { - if ctx.Request.Host != "" { - headerValues[i] = "host:" + ctx.Request.Host - } else { - headerValues[i] = "host:" + ctx.Request.URL.Host - } - } else { - headerValues[i] = k + ":" + - strings.Join(ctx.SignedHeaderVals[k], ",") - } - } - stripExcessSpaces(headerValues) - ctx.canonicalHeaders = strings.Join(headerValues, "\n") -} - -func (ctx *signingCtx) buildCanonicalString() { - ctx.Request.URL.RawQuery = strings.Replace(ctx.Query.Encode(), "+", "%20", -1) - - uri := getURIPath(ctx.Request.URL) - - if !ctx.DisableURIPathEscaping { - uri = rest.EscapePath(uri, false) - } - - ctx.canonicalString = strings.Join([]string{ - ctx.Request.Method, - uri, - ctx.Request.URL.RawQuery, - ctx.canonicalHeaders + "\n", - ctx.signedHeaders, - ctx.bodyDigest, - }, "\n") -} - -func (ctx *signingCtx) buildStringToSign() { - ctx.stringToSign = strings.Join([]string{ - authHeaderPrefix, - ctx.formattedTime, - ctx.credentialString, - hex.EncodeToString(makeSha256([]byte(ctx.canonicalString))), - }, "\n") -} - -func (ctx *signingCtx) buildSignature() { - secret := ctx.credValues.SecretAccessKey - date := makeHmac([]byte("AWS4"+secret), []byte(ctx.formattedShortTime)) - region := makeHmac(date, []byte(ctx.Region)) - service := makeHmac(region, []byte(ctx.ServiceName)) - credentials := makeHmac(service, []byte("aws4_request")) - signature := makeHmac(credentials, []byte(ctx.stringToSign)) - ctx.signature = hex.EncodeToString(signature) -} - -func (ctx *signingCtx) buildBodyDigest() { - hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") - if hash == "" { - if ctx.unsignedPayload || (ctx.isPresign && ctx.ServiceName == "s3") { - hash = "UNSIGNED-PAYLOAD" - } else if ctx.Body == nil { - hash = emptyStringSHA256 - } else { - hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) - } - if ctx.unsignedPayload || ctx.ServiceName == "s3" || ctx.ServiceName == "glacier" { - ctx.Request.Header.Set("X-Amz-Content-Sha256", hash) - } - } - ctx.bodyDigest = hash -} - -// isRequestSigned returns if the request is currently signed or presigned -func (ctx *signingCtx) isRequestSigned() bool { - if ctx.isPresign && ctx.Query.Get("X-Amz-Signature") != "" { - return true - } - if ctx.Request.Header.Get("Authorization") != "" { - return true - } - - return false -} - -// unsign removes signing flags for both signed and presigned requests. -func (ctx *signingCtx) removePresign() { - ctx.Query.Del("X-Amz-Algorithm") - ctx.Query.Del("X-Amz-Signature") - ctx.Query.Del("X-Amz-Security-Token") - ctx.Query.Del("X-Amz-Date") - ctx.Query.Del("X-Amz-Expires") - ctx.Query.Del("X-Amz-Credential") - ctx.Query.Del("X-Amz-SignedHeaders") -} - -func makeHmac(key []byte, data []byte) []byte { - hash := hmac.New(sha256.New, key) - hash.Write(data) - return hash.Sum(nil) -} - -func makeSha256(data []byte) []byte { - hash := sha256.New() - hash.Write(data) - return hash.Sum(nil) -} - -func makeSha256Reader(reader io.ReadSeeker) []byte { - hash := sha256.New() - start, _ := reader.Seek(0, 1) - defer reader.Seek(start, 0) - - io.Copy(hash, reader) - return hash.Sum(nil) -} - -const doubleSpace = " " - -// stripExcessSpaces will rewrite the passed in slice's string values to not -// contain muliple side-by-side spaces. -func stripExcessSpaces(vals []string) { - var j, k, l, m, spaces int - for i, str := range vals { - // Trim trailing spaces - for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- { - } - - // Trim leading spaces - for k = 0; k < j && str[k] == ' '; k++ { - } - str = str[k : j+1] - - // Strip multiple spaces. - j = strings.Index(str, doubleSpace) - if j < 0 { - vals[i] = str - continue - } - - buf := []byte(str) - for k, m, l = j, j, len(buf); k < l; k++ { - if buf[k] == ' ' { - if spaces == 0 { - // First space. - buf[m] = buf[k] - m++ - } - spaces++ - } else { - // End of multiple spaces. - spaces = 0 - buf[m] = buf[k] - m++ - } - } - - vals[i] = string(buf[:m]) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go deleted file mode 100644 index 45d0eb88..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go +++ /dev/null @@ -1,644 +0,0 @@ -package v4 - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" - "net/http/httptest" - "reflect" - "strings" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" -) - -func TestStripExcessHeaders(t *testing.T) { - vals := []string{ - "", - "123", - "1 2 3", - "1 2 3 ", - " 1 2 3", - "1 2 3", - "1 23", - "1 2 3", - "1 2 ", - " 1 2 ", - "12 3", - "12 3 1", - "12 3 1", - "12 3 1abc123", - } - - expected := []string{ - "", - "123", - "1 2 3", - "1 2 3", - "1 2 3", - "1 2 3", - "1 23", - "1 2 3", - "1 2", - "1 2", - "12 3", - "12 3 1", - "12 3 1", - "12 3 1abc123", - } - - stripExcessSpaces(vals) - for i := 0; i < len(vals); i++ { - if e, a := expected[i], vals[i]; e != a { - t.Errorf("%d, expect %v, got %v", i, e, a) - } - } -} - -func buildRequest(serviceName, region, body string) (*http.Request, io.ReadSeeker) { - endpoint := "https://" + serviceName + "." + region + ".amazonaws.com" - reader := strings.NewReader(body) - req, _ := http.NewRequest("POST", endpoint, reader) - req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()" - req.Header.Add("X-Amz-Target", "prefix.Operation") - req.Header.Add("Content-Type", "application/x-amz-json-1.0") - req.Header.Add("Content-Length", string(len(body))) - req.Header.Add("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)") - req.Header.Add("X-Amz-Meta-Other-Header_With_Underscore", "some-value=!@#$%^&* (+)") - req.Header.Add("X-amz-Meta-Other-Header_With_Underscore", "some-value=!@#$%^&* (+)") - return req, reader -} - -func buildSigner() Signer { - return Signer{ - Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), - } -} - -func removeWS(text string) string { - text = strings.Replace(text, " ", "", -1) - text = strings.Replace(text, "\n", "", -1) - text = strings.Replace(text, "\t", "", -1) - return text -} - -func assertEqual(t *testing.T, expected, given string) { - if removeWS(expected) != removeWS(given) { - t.Errorf("\nExpected: %s\nGiven: %s", expected, given) - } -} - -func TestPresignRequest(t *testing.T) { - req, body := buildRequest("dynamodb", "us-east-1", "{}") - - signer := buildSigner() - signer.Presign(req, body, "dynamodb", "us-east-1", 300*time.Second, time.Unix(0, 0)) - - expectedDate := "19700101T000000Z" - expectedHeaders := "content-length;content-type;host;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore" - expectedSig := "ea7856749041f727690c580569738282e99c79355fe0d8f125d3b5535d2ece83" - expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" - expectedTarget := "prefix.Operation" - - q := req.URL.Query() - if e, a := expectedSig, q.Get("X-Amz-Signature"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedCred, q.Get("X-Amz-Credential"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedHeaders, q.Get("X-Amz-SignedHeaders"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedDate, q.Get("X-Amz-Date"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if a := q.Get("X-Amz-Meta-Other-Header"); len(a) != 0 { - t.Errorf("expect %v to be empty", a) - } - if e, a := expectedTarget, q.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestPresignBodyWithArrayRequest(t *testing.T) { - req, body := buildRequest("dynamodb", "us-east-1", "{}") - req.URL.RawQuery = "Foo=z&Foo=o&Foo=m&Foo=a" - - signer := buildSigner() - signer.Presign(req, body, "dynamodb", "us-east-1", 300*time.Second, time.Unix(0, 0)) - - expectedDate := "19700101T000000Z" - expectedHeaders := "content-length;content-type;host;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore" - expectedSig := "fef6002062400bbf526d70f1a6456abc0fb2e213fe1416012737eebd42a62924" - expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" - expectedTarget := "prefix.Operation" - - q := req.URL.Query() - if e, a := expectedSig, q.Get("X-Amz-Signature"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedCred, q.Get("X-Amz-Credential"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedHeaders, q.Get("X-Amz-SignedHeaders"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedDate, q.Get("X-Amz-Date"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if a := q.Get("X-Amz-Meta-Other-Header"); len(a) != 0 { - t.Errorf("expect %v to be empty, was not", a) - } - if e, a := expectedTarget, q.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestSignRequest(t *testing.T) { - req, body := buildRequest("dynamodb", "us-east-1", "{}") - signer := buildSigner() - signer.Sign(req, body, "dynamodb", "us-east-1", time.Unix(0, 0)) - - expectedDate := "19700101T000000Z" - expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore;x-amz-security-token;x-amz-target, Signature=ea766cabd2ec977d955a3c2bae1ae54f4515d70752f2207618396f20aa85bd21" - - q := req.Header - if e, a := expectedSig, q.Get("Authorization"); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := expectedDate, q.Get("X-Amz-Date"); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestSignBodyS3(t *testing.T) { - req, body := buildRequest("s3", "us-east-1", "hello") - signer := buildSigner() - signer.Sign(req, body, "s3", "us-east-1", time.Now()) - hash := req.Header.Get("X-Amz-Content-Sha256") - if e, a := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestSignBodyGlacier(t *testing.T) { - req, body := buildRequest("glacier", "us-east-1", "hello") - signer := buildSigner() - signer.Sign(req, body, "glacier", "us-east-1", time.Now()) - hash := req.Header.Get("X-Amz-Content-Sha256") - if e, a := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestPresignEmptyBodyS3(t *testing.T) { - req, body := buildRequest("s3", "us-east-1", "hello") - signer := buildSigner() - signer.Presign(req, body, "s3", "us-east-1", 5*time.Minute, time.Now()) - hash := req.Header.Get("X-Amz-Content-Sha256") - if e, a := "UNSIGNED-PAYLOAD", hash; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestSignPrecomputedBodyChecksum(t *testing.T) { - req, body := buildRequest("dynamodb", "us-east-1", "hello") - req.Header.Set("X-Amz-Content-Sha256", "PRECOMPUTED") - signer := buildSigner() - signer.Sign(req, body, "dynamodb", "us-east-1", time.Now()) - hash := req.Header.Get("X-Amz-Content-Sha256") - if e, a := "PRECOMPUTED", hash; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestAnonymousCredentials(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{Credentials: credentials.AnonymousCredentials}) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - SignSDKRequest(r) - - urlQ := r.HTTPRequest.URL.Query() - if a := urlQ.Get("X-Amz-Signature"); len(a) != 0 { - t.Errorf("expect %v to be empty, was not", a) - } - if a := urlQ.Get("X-Amz-Credential"); len(a) != 0 { - t.Errorf("expect %v to be empty, was not", a) - } - if a := urlQ.Get("X-Amz-SignedHeaders"); len(a) != 0 { - t.Errorf("expect %v to be empty, was not", a) - } - if a := urlQ.Get("X-Amz-Date"); len(a) != 0 { - t.Errorf("expect %v to be empty, was not", a) - } - - hQ := r.HTTPRequest.Header - if a := hQ.Get("Authorization"); len(a) != 0 { - t.Errorf("expect %v to be empty, was not", a) - } - if a := hQ.Get("X-Amz-Date"); len(a) != 0 { - t.Errorf("expect %v to be empty, was not", a) - } -} - -func TestIgnoreResignRequestWithValidCreds(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{ - Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), - Region: aws.String("us-west-2"), - }) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - - SignSDKRequest(r) - sig := r.HTTPRequest.Header.Get("Authorization") - - signSDKRequestWithCurrTime(r, func() time.Time { - // Simulate one second has passed so that signature's date changes - // when it is resigned. - return time.Now().Add(1 * time.Second) - }) - if e, a := sig, r.HTTPRequest.Header.Get("Authorization"); e == a { - t.Errorf("expect %v to be %v, but was not", e, a) - } -} - -func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { - svc := awstesting.NewClient(&aws.Config{ - Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), - Region: aws.String("us-west-2"), - }) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - r.ExpireTime = time.Minute * 10 - - SignSDKRequest(r) - sig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature") - - signSDKRequestWithCurrTime(r, func() time.Time { - // Simulate one second has passed so that signature's date changes - // when it is resigned. - return time.Now().Add(1 * time.Second) - }) - if e, a := sig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature"); e == a { - t.Errorf("expect %v to be %v, but was not", e, a) - } -} - -func TestResignRequestExpiredCreds(t *testing.T) { - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - svc := awstesting.NewClient(&aws.Config{Credentials: creds}) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - SignSDKRequest(r) - querySig := r.HTTPRequest.Header.Get("Authorization") - var origSignedHeaders string - for _, p := range strings.Split(querySig, ", ") { - if strings.HasPrefix(p, "SignedHeaders=") { - origSignedHeaders = p[len("SignedHeaders="):] - break - } - } - if a := origSignedHeaders; len(a) == 0 { - t.Errorf("expect not to be empty, but was") - } - if e, a := origSignedHeaders, "authorization"; strings.Contains(a, e) { - t.Errorf("expect %v to not be in %v, but was", e, a) - } - origSignedAt := r.LastSignedAt - - creds.Expire() - - signSDKRequestWithCurrTime(r, func() time.Time { - // Simulate one second has passed so that signature's date changes - // when it is resigned. - return time.Now().Add(1 * time.Second) - }) - updatedQuerySig := r.HTTPRequest.Header.Get("Authorization") - if e, a := querySig, updatedQuerySig; e == a { - t.Errorf("expect %v to be %v, was not", e, a) - } - - var updatedSignedHeaders string - for _, p := range strings.Split(updatedQuerySig, ", ") { - if strings.HasPrefix(p, "SignedHeaders=") { - updatedSignedHeaders = p[len("SignedHeaders="):] - break - } - } - if a := updatedSignedHeaders; len(a) == 0 { - t.Errorf("expect not to be empty, but was") - } - if e, a := updatedQuerySig, "authorization"; strings.Contains(a, e) { - t.Errorf("expect %v to not be in %v, but was", e, a) - } - if e, a := origSignedAt, r.LastSignedAt; e == a { - t.Errorf("expect %v to be %v, was not", e, a) - } -} - -func TestPreResignRequestExpiredCreds(t *testing.T) { - provider := &credentials.StaticProvider{Value: credentials.Value{ - AccessKeyID: "AKID", - SecretAccessKey: "SECRET", - SessionToken: "SESSION", - }} - creds := credentials.NewCredentials(provider) - svc := awstesting.NewClient(&aws.Config{Credentials: creds}) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - r.ExpireTime = time.Minute * 10 - - SignSDKRequest(r) - querySig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature") - signedHeaders := r.HTTPRequest.URL.Query().Get("X-Amz-SignedHeaders") - if a := signedHeaders; len(a) == 0 { - t.Errorf("expect not to be empty, but was") - } - origSignedAt := r.LastSignedAt - - creds.Expire() - - signSDKRequestWithCurrTime(r, func() time.Time { - // Simulate the request occurred 15 minutes in the past - return time.Now().Add(-48 * time.Hour) - }) - if e, a := querySig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature"); e == a { - t.Errorf("expect %v to be %v, was not", e, a) - } - resignedHeaders := r.HTTPRequest.URL.Query().Get("X-Amz-SignedHeaders") - if e, a := signedHeaders, resignedHeaders; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := signedHeaders, "x-amz-signedHeaders"; strings.Contains(a, e) { - t.Errorf("expect %v to not be in %v, but was", e, a) - } - if e, a := origSignedAt, r.LastSignedAt; e == a { - t.Errorf("expect %v to be %v, was not", e, a) - } -} - -func TestResignRequestExpiredRequest(t *testing.T) { - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - svc := awstesting.NewClient(&aws.Config{Credentials: creds}) - r := svc.NewRequest( - &request.Operation{ - Name: "BatchGetItem", - HTTPMethod: "POST", - HTTPPath: "/", - }, - nil, - nil, - ) - - SignSDKRequest(r) - querySig := r.HTTPRequest.Header.Get("Authorization") - origSignedAt := r.LastSignedAt - - signSDKRequestWithCurrTime(r, func() time.Time { - // Simulate the request occurred 15 minutes in the past - return time.Now().Add(15 * time.Minute) - }) - if e, a := querySig, r.HTTPRequest.Header.Get("Authorization"); e == a { - t.Errorf("expect %v to be %v, was not", e, a) - } - if e, a := origSignedAt, r.LastSignedAt; e == a { - t.Errorf("expect %v to be %v, was not", e, a) - } -} - -func TestSignWithRequestBody(t *testing.T) { - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - signer := NewSigner(creds) - - expectBody := []byte("abc123") - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) - r.Body.Close() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := expectBody, b; !reflect.DeepEqual(e, a) { - t.Errorf("expect %v, got %v", e, a) - } - w.WriteHeader(http.StatusOK) - })) - - req, err := http.NewRequest("POST", server.URL, nil) - - _, err = signer.Sign(req, bytes.NewReader(expectBody), "service", "region", time.Now()) - if err != nil { - t.Errorf("expect not no error, got %v", err) - } - - resp, err := http.DefaultClient.Do(req) - if err != nil { - t.Errorf("expect not no error, got %v", err) - } - if e, a := http.StatusOK, resp.StatusCode; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestSignWithRequestBody_Overwrite(t *testing.T) { - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - signer := NewSigner(creds) - - var expectBody []byte - - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) - r.Body.Close() - if err != nil { - t.Errorf("expect not no error, got %v", err) - } - if e, a := len(expectBody), len(b); e != a { - t.Errorf("expect %v, got %v", e, a) - } - w.WriteHeader(http.StatusOK) - })) - - req, err := http.NewRequest("GET", server.URL, strings.NewReader("invalid body")) - - _, err = signer.Sign(req, nil, "service", "region", time.Now()) - req.ContentLength = 0 - - if err != nil { - t.Errorf("expect not no error, got %v", err) - } - - resp, err := http.DefaultClient.Do(req) - if err != nil { - t.Errorf("expect not no error, got %v", err) - } - if e, a := http.StatusOK, resp.StatusCode; e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestBuildCanonicalRequest(t *testing.T) { - req, body := buildRequest("dynamodb", "us-east-1", "{}") - req.URL.RawQuery = "Foo=z&Foo=o&Foo=m&Foo=a" - ctx := &signingCtx{ - ServiceName: "dynamodb", - Region: "us-east-1", - Request: req, - Body: body, - Query: req.URL.Query(), - Time: time.Now(), - ExpireTime: 5 * time.Second, - } - - ctx.buildCanonicalString() - expected := "https://example.org/bucket/key-._~,!@#$%^&*()?Foo=z&Foo=o&Foo=m&Foo=a" - if e, a := expected, ctx.Request.URL.String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestSignWithBody_ReplaceRequestBody(t *testing.T) { - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - req, seekerBody := buildRequest("dynamodb", "us-east-1", "{}") - req.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) - - s := NewSigner(creds) - origBody := req.Body - - _, err := s.Sign(req, seekerBody, "dynamodb", "us-east-1", time.Now()) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if req.Body == origBody { - t.Errorf("expeect request body to not be origBody") - } - - if req.Body == nil { - t.Errorf("expect request body to be changed but was nil") - } -} - -func TestSignWithBody_NoReplaceRequestBody(t *testing.T) { - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - req, seekerBody := buildRequest("dynamodb", "us-east-1", "{}") - req.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) - - s := NewSigner(creds, func(signer *Signer) { - signer.DisableRequestBodyOverwrite = true - }) - - origBody := req.Body - - _, err := s.Sign(req, seekerBody, "dynamodb", "us-east-1", time.Now()) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if req.Body != origBody { - t.Errorf("expect request body to not be chagned") - } -} - -func TestRequestHost(t *testing.T) { - req, body := buildRequest("dynamodb", "us-east-1", "{}") - req.URL.RawQuery = "Foo=z&Foo=o&Foo=m&Foo=a" - req.Host = "myhost" - ctx := &signingCtx{ - ServiceName: "dynamodb", - Region: "us-east-1", - Request: req, - Body: body, - Query: req.URL.Query(), - Time: time.Now(), - ExpireTime: 5 * time.Second, - } - - ctx.buildCanonicalHeaders(ignoredHeaders, ctx.Request.Header) - if !strings.Contains(ctx.canonicalHeaders, "host:"+req.Host) { - t.Errorf("canonical host header invalid") - } -} - -func BenchmarkPresignRequest(b *testing.B) { - signer := buildSigner() - req, body := buildRequest("dynamodb", "us-east-1", "{}") - for i := 0; i < b.N; i++ { - signer.Presign(req, body, "dynamodb", "us-east-1", 300*time.Second, time.Now()) - } -} - -func BenchmarkSignRequest(b *testing.B) { - signer := buildSigner() - req, body := buildRequest("dynamodb", "us-east-1", "{}") - for i := 0; i < b.N; i++ { - signer.Sign(req, body, "dynamodb", "us-east-1", time.Now()) - } -} - -var stripExcessSpaceCases = []string{ - `AWS4-HMAC-SHA256 Credential=AKIDFAKEIDFAKEID/20160628/us-west-2/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=1234567890abcdef1234567890abcdef1234567890abcdef`, - `123 321 123 321`, - ` 123 321 123 321 `, - ` 123 321 123 321 `, - "123", - "1 2 3", - " 1 2 3", - "1 2 3", - "1 23", - "1 2 3", - "1 2 ", - " 1 2 ", - "12 3", - "12 3 1", - "12 3 1", - "12 3 1abc123", -} - -func BenchmarkStripExcessSpaces(b *testing.B) { - for i := 0; i < b.N; i++ { - // Make sure to start with a copy of the cases - cases := append([]string{}, stripExcessSpaceCases...) - stripExcessSpaces(cases) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go deleted file mode 100644 index 0e2d864e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ /dev/null @@ -1,118 +0,0 @@ -package aws - -import ( - "io" - "sync" -) - -// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Should -// only be used with an io.Reader that is also an io.Seeker. Doing so may -// cause request signature errors, or request body's not sent for GET, HEAD -// and DELETE HTTP methods. -// -// Deprecated: Should only be used with io.ReadSeeker. If using for -// S3 PutObject to stream content use s3manager.Uploader instead. -func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { - return ReaderSeekerCloser{r} -} - -// ReaderSeekerCloser represents a reader that can also delegate io.Seeker and -// io.Closer interfaces to the underlying object if they are available. -type ReaderSeekerCloser struct { - r io.Reader -} - -// Read reads from the reader up to size of p. The number of bytes read, and -// error if it occurred will be returned. -// -// If the reader is not an io.Reader zero bytes read, and nil error will be returned. -// -// Performs the same functionality as io.Reader Read -func (r ReaderSeekerCloser) Read(p []byte) (int, error) { - switch t := r.r.(type) { - case io.Reader: - return t.Read(p) - } - return 0, nil -} - -// Seek sets the offset for the next Read to offset, interpreted according to -// whence: 0 means relative to the origin of the file, 1 means relative to the -// current offset, and 2 means relative to the end. Seek returns the new offset -// and an error, if any. -// -// If the ReaderSeekerCloser is not an io.Seeker nothing will be done. -func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error) { - switch t := r.r.(type) { - case io.Seeker: - return t.Seek(offset, whence) - } - return int64(0), nil -} - -// IsSeeker returns if the underlying reader is also a seeker. -func (r ReaderSeekerCloser) IsSeeker() bool { - _, ok := r.r.(io.Seeker) - return ok -} - -// Close closes the ReaderSeekerCloser. -// -// If the ReaderSeekerCloser is not an io.Closer nothing will be done. -func (r ReaderSeekerCloser) Close() error { - switch t := r.r.(type) { - case io.Closer: - return t.Close() - } - return nil -} - -// A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface -// Can be used with the s3manager.Downloader to download content to a buffer -// in memory. Safe to use concurrently. -type WriteAtBuffer struct { - buf []byte - m sync.Mutex - - // GrowthCoeff defines the growth rate of the internal buffer. By - // default, the growth rate is 1, where expanding the internal - // buffer will allocate only enough capacity to fit the new expected - // length. - GrowthCoeff float64 -} - -// NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer -// provided by buf. -func NewWriteAtBuffer(buf []byte) *WriteAtBuffer { - return &WriteAtBuffer{buf: buf} -} - -// WriteAt writes a slice of bytes to a buffer starting at the position provided -// The number of bytes written will be returned, or error. Can overwrite previous -// written slices if the write ats overlap. -func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) { - pLen := len(p) - expLen := pos + int64(pLen) - b.m.Lock() - defer b.m.Unlock() - if int64(len(b.buf)) < expLen { - if int64(cap(b.buf)) < expLen { - if b.GrowthCoeff < 1 { - b.GrowthCoeff = 1 - } - newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen))) - copy(newBuf, b.buf) - b.buf = newBuf - } - b.buf = b.buf[:expLen] - } - copy(b.buf[pos:], p) - return pLen, nil -} - -// Bytes returns a slice of bytes written to the buffer. -func (b *WriteAtBuffer) Bytes() []byte { - b.m.Lock() - defer b.m.Unlock() - return b.buf -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types_test.go b/vendor/github.com/aws/aws-sdk-go/aws/types_test.go deleted file mode 100644 index e399ef57..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/types_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package aws - -import ( - "bytes" - "math/rand" - "testing" -) - -func TestWriteAtBuffer(t *testing.T) { - b := &WriteAtBuffer{} - - n, err := b.WriteAt([]byte{1}, 0) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := 1, n; e != a { - t.Errorf("expected %d, but recieved %d", e, a) - } - - n, err = b.WriteAt([]byte{1, 1, 1}, 5) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := 3, n; e != a { - t.Errorf("expected %d, but recieved %d", e, a) - } - - n, err = b.WriteAt([]byte{2}, 1) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := 1, n; e != a { - t.Errorf("expected %d, but recieved %d", e, a) - } - - n, err = b.WriteAt([]byte{3}, 2) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := 1, n; e != a { - t.Errorf("expected %d, but received %d", e, a) - } - - if !bytes.Equal([]byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes()) { - t.Errorf("expected %v, but received %v", []byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes()) - } -} - -func BenchmarkWriteAtBuffer(b *testing.B) { - buf := &WriteAtBuffer{} - r := rand.New(rand.NewSource(1)) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - to := r.Intn(10) * 4096 - bs := make([]byte, to) - buf.WriteAt(bs, r.Int63n(10)*4096) - } -} - -func BenchmarkWriteAtBufferOrderedWrites(b *testing.B) { - // test the performance of a WriteAtBuffer when written in an - // ordered fashion. This is similar to the behavior of the - // s3.Downloader, since downloads the first chunk of the file, then - // the second, and so on. - // - // This test simulates a 150MB file being written in 30 ordered 5MB chunks. - chunk := int64(5e6) - max := chunk * 30 - // we'll write the same 5MB chunk every time - tmp := make([]byte, chunk) - for i := 0; i < b.N; i++ { - buf := &WriteAtBuffer{} - for i := int64(0); i < max; i += chunk { - buf.WriteAt(tmp, i) - } - } -} - -func BenchmarkWriteAtBufferParallel(b *testing.B) { - buf := &WriteAtBuffer{} - r := rand.New(rand.NewSource(1)) - - b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - to := r.Intn(10) * 4096 - bs := make([]byte, to) - buf.WriteAt(bs, r.Int63n(10)*4096) - } - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/url.go b/vendor/github.com/aws/aws-sdk-go/aws/url.go deleted file mode 100644 index 6192b245..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/url.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build go1.8 - -package aws - -import "net/url" - -// URLHostname will extract the Hostname without port from the URL value. -// -// Wrapper of net/url#URL.Hostname for backwards Go version compatibility. -func URLHostname(url *url.URL) string { - return url.Hostname() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go deleted file mode 100644 index 0210d272..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go +++ /dev/null @@ -1,29 +0,0 @@ -// +build !go1.8 - -package aws - -import ( - "net/url" - "strings" -) - -// URLHostname will extract the Hostname without port from the URL value. -// -// Copy of Go 1.8's net/url#URL.Hostname functionality. -func URLHostname(url *url.URL) string { - return stripPort(url.Host) - -} - -// stripPort is copy of Go 1.8 url#URL.Hostname functionality. -// https://golang.org/src/net/url/url.go -func stripPort(hostport string) string { - colon := strings.IndexByte(hostport, ':') - if colon == -1 { - return hostport - } - if i := strings.IndexByte(hostport, ']'); i != -1 { - return strings.TrimPrefix(hostport[:i], "[") - } - return hostport[:colon] -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go deleted file mode 100644 index 999d82a4..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ /dev/null @@ -1,8 +0,0 @@ -// Package aws provides core functionality for making requests to AWS services. -package aws - -// SDKName is the name of this AWS SDK -const SDKName = "aws-sdk-go" - -// SDKVersion is the version of this SDK -const SDKVersion = "1.12.16" diff --git a/vendor/github.com/aws/aws-sdk-go/buildspec.yml b/vendor/github.com/aws/aws-sdk-go/buildspec.yml deleted file mode 100644 index 427208ed..00000000 --- a/vendor/github.com/aws/aws-sdk-go/buildspec.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: 0.2 - -phases: - build: - commands: - - echo Build started on `date` - - export GOPATH=/go - - export SDK_CB_ROOT=`pwd` - - export SDK_GO_ROOT=/go/src/github.com/aws/aws-sdk-go - - mkdir -p /go/src/github.com/aws - - ln -s $SDK_CB_ROOT $SDK_GO_ROOT - - cd $SDK_GO_ROOT - - make unit - - cd $SDK_CB_ROOT - - #echo Compiling the Go code... - post_build: - commands: - - echo Build completed on `date` -#artifacts: -# files: -# - hello diff --git a/vendor/github.com/aws/aws-sdk-go/doc.go b/vendor/github.com/aws/aws-sdk-go/doc.go deleted file mode 100644 index 3e077e51..00000000 --- a/vendor/github.com/aws/aws-sdk-go/doc.go +++ /dev/null @@ -1,405 +0,0 @@ -// Package sdk is the official AWS SDK for the Go programming language. -// -// The AWS SDK for Go provides APIs and utilities that developers can use to -// build Go applications that use AWS services, such as Amazon Elastic Compute -// Cloud (Amazon EC2) and Amazon Simple Storage Service (Amazon S3). -// -// The SDK removes the complexity of coding directly against a web service -// interface. It hides a lot of the lower-level plumbing, such as authentication, -// request retries, and error handling. -// -// The SDK also includes helpful utilities on top of the AWS APIs that add additional -// capabilities and functionality. For example, the Amazon S3 Download and Upload -// Manager will automatically split up large objects into multiple parts and -// transfer them concurrently. -// -// See the s3manager package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/ -// -// Getting More Information -// -// Checkout the Getting Started Guide and API Reference Docs detailed the SDK's -// components and details on each AWS client the SDK supports. -// -// The Getting Started Guide provides examples and detailed description of how -// to get setup with the SDK. -// https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/welcome.html -// -// The API Reference Docs include a detailed breakdown of the SDK's components -// such as utilities and AWS clients. Use this as a reference of the Go types -// included with the SDK, such as AWS clients, API operations, and API parameters. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// Overview of SDK's Packages -// -// The SDK is composed of two main components, SDK core, and service clients. -// The SDK core packages are all available under the aws package at the root of -// the SDK. Each client for a supported AWS service is available within its own -// package under the service folder at the root of the SDK. -// -// * aws - SDK core, provides common shared types such as Config, Logger, -// and utilities to make working with API parameters easier. -// -// * awserr - Provides the error interface that the SDK will use for all -// errors that occur in the SDK's processing. This includes service API -// response errors as well. The Error type is made up of a code and message. -// Cast the SDK's returned error type to awserr.Error and call the Code -// method to compare returned error to specific error codes. See the package's -// documentation for additional values that can be extracted such as RequestId. -// -// * credentials - Provides the types and built in credentials providers -// the SDK will use to retrieve AWS credentials to make API requests with. -// Nested under this folder are also additional credentials providers such as -// stscreds for assuming IAM roles, and ec2rolecreds for EC2 Instance roles. -// -// * endpoints - Provides the AWS Regions and Endpoints metadata for the SDK. -// Use this to lookup AWS service endpoint information such as which services -// are in a region, and what regions a service is in. Constants are also provided -// for all region identifiers, e.g UsWest2RegionID for "us-west-2". -// -// * session - Provides initial default configuration, and load -// configuration from external sources such as environment and shared -// credentials file. -// -// * request - Provides the API request sending, and retry logic for the SDK. -// This package also includes utilities for defining your own request -// retryer, and configuring how the SDK processes the request. -// -// * service - Clients for AWS services. All services supported by the SDK are -// available under this folder. -// -// How to Use the SDK's AWS Service Clients -// -// The SDK includes the Go types and utilities you can use to make requests to -// AWS service APIs. Within the service folder at the root of the SDK you'll find -// a package for each AWS service the SDK supports. All service clients follows -// a common pattern of creation and usage. -// -// When creating a client for an AWS service you'll first need to have a Session -// value constructed. The Session provides shared configuration that can be shared -// between your service clients. When service clients are created you can pass -// in additional configuration via the aws.Config type to override configuration -// provided by in the Session to create service client instances with custom -// configuration. -// -// Once the service's client is created you can use it to make API requests the -// AWS service. These clients are safe to use concurrently. -// -// Configuring the SDK -// -// In the AWS SDK for Go, you can configure settings for service clients, such -// as the log level and maximum number of retries. Most settings are optional; -// however, for each service client, you must specify a region and your credentials. -// The SDK uses these values to send requests to the correct AWS region and sign -// requests with the correct credentials. You can specify these values as part -// of a session or as environment variables. -// -// See the SDK's configuration guide for more information. -// https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html -// -// See the session package documentation for more information on how to use Session -// with the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/session/ -// -// See the Config type in the aws package for more information on configuration -// options. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// Configuring Credentials -// -// When using the SDK you'll generally need your AWS credentials to authenticate -// with AWS services. The SDK supports multiple methods of supporting these -// credentials. By default the SDK will source credentials automatically from -// its default credential chain. See the session package for more information -// on this chain, and how to configure it. The common items in the credential -// chain are the following: -// -// * Environment Credentials - Set of environment variables that are useful -// when sub processes are created for specific roles. -// -// * Shared Credentials file (~/.aws/credentials) - This file stores your -// credentials based on a profile name and is useful for local development. -// -// * EC2 Instance Role Credentials - Use EC2 Instance Role to assign credentials -// to application running on an EC2 instance. This removes the need to manage -// credential files in production. -// -// Credentials can be configured in code as well by setting the Config's Credentials -// value to a custom provider or using one of the providers included with the -// SDK to bypass the default credential chain and use a custom one. This is -// helpful when you want to instruct the SDK to only use a specific set of -// credentials or providers. -// -// This example creates a credential provider for assuming an IAM role, "myRoleARN" -// and configures the S3 service client to use that role for API requests. -// -// // Initial credentials loaded from SDK's default credential chain. Such as -// // the environment, shared credentials (~/.aws/credentials), or EC2 Instance -// // Role. These credentials will be used to to make the STS Assume Role API. -// sess := session.Must(session.NewSession()) -// -// // Create the credentials from AssumeRoleProvider to assume the role -// // referenced by the "myRoleARN" ARN. -// creds := stscreds.NewCredentials(sess, "myRoleArn") -// -// // Create service client value configured for credentials -// // from assumed role. -// svc := s3.New(sess, &aws.Config{Credentials: creds})/ -// -// See the credentials package documentation for more information on credential -// providers included with the SDK, and how to customize the SDK's usage of -// credentials. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/credentials -// -// The SDK has support for the shared configuration file (~/.aws/config). This -// support can be enabled by setting the environment variable, "AWS_SDK_LOAD_CONFIG=1", -// or enabling the feature in code when creating a Session via the -// Option's SharedConfigState parameter. -// -// sess := session.Must(session.NewSessionWithOptions(session.Options{ -// SharedConfigState: session.SharedConfigEnable, -// })) -// -// Configuring AWS Region -// -// In addition to the credentials you'll need to specify the region the SDK -// will use to make AWS API requests to. In the SDK you can specify the region -// either with an environment variable, or directly in code when a Session or -// service client is created. The last value specified in code wins if the region -// is specified multiple ways. -// -// To set the region via the environment variable set the "AWS_REGION" to the -// region you want to the SDK to use. Using this method to set the region will -// allow you to run your application in multiple regions without needing additional -// code in the application to select the region. -// -// AWS_REGION=us-west-2 -// -// The endpoints package includes constants for all regions the SDK knows. The -// values are all suffixed with RegionID. These values are helpful, because they -// reduce the need to type the region string manually. -// -// To set the region on a Session use the aws package's Config struct parameter -// Region to the AWS region you want the service clients created from the session to -// use. This is helpful when you want to create multiple service clients, and -// all of the clients make API requests to the same region. -// -// sess := session.Must(session.NewSession(&aws.Config{ -// Region: aws.String(endpoints.UsWest2RegionID), -// })) -// -// See the endpoints package for the AWS Regions and Endpoints metadata. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/endpoints/ -// -// In addition to setting the region when creating a Session you can also set -// the region on a per service client bases. This overrides the region of a -// Session. This is helpful when you want to create service clients in specific -// regions different from the Session's region. -// -// svc := s3.New(sess, &aws.Config{ -// Region: aws.String(ednpoints.UsWest2RegionID), -// }) -// -// See the Config type in the aws package for more information and additional -// options such as setting the Endpoint, and other service client configuration options. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// Making API Requests -// -// Once the client is created you can make an API request to the service. -// Each API method takes a input parameter, and returns the service response -// and an error. The SDK provides methods for making the API call in multiple ways. -// -// In this list we'll use the S3 ListObjects API as an example for the different -// ways of making API requests. -// -// * ListObjects - Base API operation that will make the API request to the service. -// -// * ListObjectsRequest - API methods suffixed with Request will construct the -// API request, but not send it. This is also helpful when you want to get a -// presigned URL for a request, and share the presigned URL instead of your -// application making the request directly. -// -// * ListObjectsPages - Same as the base API operation, but uses a callback to -// automatically handle pagination of the API's response. -// -// * ListObjectsWithContext - Same as base API operation, but adds support for -// the Context pattern. This is helpful for controlling the canceling of in -// flight requests. See the Go standard library context package for more -// information. This method also takes request package's Option functional -// options as the variadic argument for modifying how the request will be -// made, or extracting information from the raw HTTP response. -// -// * ListObjectsPagesWithContext - same as ListObjectsPages, but adds support for -// the Context pattern. Similar to ListObjectsWithContext this method also -// takes the request package's Option function option types as the variadic -// argument. -// -// In addition to the API operations the SDK also includes several higher level -// methods that abstract checking for and waiting for an AWS resource to be in -// a desired state. In this list we'll use WaitUntilBucketExists to demonstrate -// the different forms of waiters. -// -// * WaitUntilBucketExists. - Method to make API request to query an AWS service for -// a resource's state. Will return successfully when that state is accomplished. -// -// * WaitUntilBucketExistsWithContext - Same as WaitUntilBucketExists, but adds -// support for the Context pattern. In addition these methods take request -// package's WaiterOptions to configure the waiter, and how underlying request -// will be made by the SDK. -// -// The API method will document which error codes the service might return for -// the operation. These errors will also be available as const strings prefixed -// with "ErrCode" in the service client's package. If there are no errors listed -// in the API's SDK documentation you'll need to consult the AWS service's API -// documentation for the errors that could be returned. -// -// ctx := context.Background() -// -// result, err := svc.GetObjectWithContext(ctx, &s3.GetObjectInput{ -// Bucket: aws.String("my-bucket"), -// Key: aws.String("my-key"), -// }) -// if err != nil { -// // Cast err to awserr.Error to handle specific error codes. -// aerr, ok := err.(awserr.Error) -// if ok && aerr.Code() == s3.ErrCodeNoSuchKey { -// // Specific error code handling -// } -// return err -// } -// -// // Make sure to close the body when done with it for S3 GetObject APIs or -// // will leak connections. -// defer result.Body.Close() -// -// fmt.Println("Object Size:", aws.StringValue(result.ContentLength)) -// -// API Request Pagination and Resource Waiters -// -// Pagination helper methods are suffixed with "Pages", and provide the -// functionality needed to round trip API page requests. Pagination methods -// take a callback function that will be called for each page of the API's response. -// -// objects := []string{} -// err := svc.ListObjectsPagesWithContext(ctx, &s3.ListObjectsInput{ -// Bucket: aws.String(myBucket), -// }, func(p *s3.ListObjectsOutput, lastPage bool) bool { -// for _, o := range p.Contents { -// objects = append(objects, aws.StringValue(o.Key)) -// } -// return true // continue paging -// }) -// if err != nil { -// panic(fmt.Sprintf("failed to list objects for bucket, %s, %v", myBucket, err)) -// } -// -// fmt.Println("Objects in bucket:", objects) -// -// Waiter helper methods provide the functionality to wait for an AWS resource -// state. These methods abstract the logic needed to to check the state of an -// AWS resource, and wait until that resource is in a desired state. The waiter -// will block until the resource is in the state that is desired, an error occurs, -// or the waiter times out. If a resource times out the error code returned will -// be request.WaiterResourceNotReadyErrorCode. -// -// err := svc.WaitUntilBucketExistsWithContext(ctx, &s3.HeadBucketInput{ -// Bucket: aws.String(myBucket), -// }) -// if err != nil { -// aerr, ok := err.(awserr.Error) -// if ok && aerr.Code() == request.WaiterResourceNotReadyErrorCode { -// fmt.Fprintf(os.Stderr, "timed out while waiting for bucket to exist") -// } -// panic(fmt.Errorf("failed to wait for bucket to exist, %v", err)) -// } -// fmt.Println("Bucket", myBucket, "exists") -// -// Complete SDK Example -// -// This example shows a complete working Go file which will upload a file to S3 -// and use the Context pattern to implement timeout logic that will cancel the -// request if it takes too long. This example highlights how to use sessions, -// create a service client, make a request, handle the error, and process the -// response. -// -// package main -// -// import ( -// "context" -// "flag" -// "fmt" -// "os" -// "time" -// -// "github.com/aws/aws-sdk-go/aws" -// "github.com/aws/aws-sdk-go/aws/awserr" -// "github.com/aws/aws-sdk-go/aws/request" -// "github.com/aws/aws-sdk-go/aws/session" -// "github.com/aws/aws-sdk-go/service/s3" -// ) -// -// // Uploads a file to S3 given a bucket and object key. Also takes a duration -// // value to terminate the update if it doesn't complete within that time. -// // -// // The AWS Region needs to be provided in the AWS shared config or on the -// // environment variable as `AWS_REGION`. Credentials also must be provided -// // Will default to shared config file, but can load from environment if provided. -// // -// // Usage: -// // # Upload myfile.txt to myBucket/myKey. Must complete within 10 minutes or will fail -// // go run withContext.go -b mybucket -k myKey -d 10m < myfile.txt -// func main() { -// var bucket, key string -// var timeout time.Duration -// -// flag.StringVar(&bucket, "b", "", "Bucket name.") -// flag.StringVar(&key, "k", "", "Object key name.") -// flag.DurationVar(&timeout, "d", 0, "Upload timeout.") -// flag.Parse() -// -// // All clients require a Session. The Session provides the client with -// // shared configuration such as region, endpoint, and credentials. A -// // Session should be shared where possible to take advantage of -// // configuration and credential caching. See the session package for -// // more information. -// sess := session.Must(session.NewSession()) -// -// // Create a new instance of the service's client with a Session. -// // Optional aws.Config values can also be provided as variadic arguments -// // to the New function. This option allows you to provide service -// // specific configuration. -// svc := s3.New(sess) -// -// // Create a context with a timeout that will abort the upload if it takes -// // more than the passed in timeout. -// ctx := context.Background() -// var cancelFn func() -// if timeout > 0 { -// ctx, cancelFn = context.WithTimeout(ctx, timeout) -// } -// // Ensure the context is canceled to prevent leaking. -// // See context package for more information, https://golang.org/pkg/context/ -// defer cancelFn() -// -// // Uploads the object to S3. The Context will interrupt the request if the -// // timeout expires. -// _, err := svc.PutObjectWithContext(ctx, &s3.PutObjectInput{ -// Bucket: aws.String(bucket), -// Key: aws.String(key), -// Body: os.Stdin, -// }) -// if err != nil { -// if aerr, ok := err.(awserr.Error); ok && aerr.Code() == request.CanceledErrorCode { -// // If the SDK can determine the request or retry delay was canceled -// // by a context the CanceledErrorCode error code will be returned. -// fmt.Fprintf(os.Stderr, "upload canceled due to timeout, %v\n", err) -// } else { -// fmt.Fprintf(os.Stderr, "failed to upload object, %v\n", err) -// } -// os.Exit(1) -// } -// -// fmt.Printf("successfully uploaded file to %s/%s\n", bucket, key) -// } -package sdk diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go deleted file mode 100644 index ebcbc2b4..00000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go +++ /dev/null @@ -1,40 +0,0 @@ -package shareddefaults - -import ( - "os" - "path/filepath" - "runtime" -) - -// SharedCredentialsFilename returns the SDK's default file path -// for the shared credentials file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/credentials -// - Windows: %USERPROFILE%\.aws\credentials -func SharedCredentialsFilename() string { - return filepath.Join(UserHomeDir(), ".aws", "credentials") -} - -// SharedConfigFilename returns the SDK's default file path for -// the shared config file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/config -// - Windows: %USERPROFILE%\.aws\config -func SharedConfigFilename() string { - return filepath.Join(UserHomeDir(), ".aws", "config") -} - -// UserHomeDir returns the home directory for the user the process is -// running under. -func UserHomeDir() string { - if runtime.GOOS == "windows" { // Windows - return os.Getenv("USERPROFILE") - } - - // *nix - return os.Getenv("HOME") -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go deleted file mode 100644 index a2fd4558..00000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_other_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package shareddefaults_test - -import ( - "os" - "path/filepath" - "testing" - - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -func TestSharedCredsFilename(t *testing.T) { - env := awstesting.StashEnv() - defer awstesting.PopEnv(env) - - os.Setenv("HOME", "home_dir") - os.Setenv("USERPROFILE", "profile_dir") - - expect := filepath.Join("home_dir", ".aws", "credentials") - - name := shareddefaults.SharedCredentialsFilename() - if e, a := expect, name; e != a { - t.Errorf("expect %q shared creds filename, got %q", e, a) - } -} - -func TestSharedConfigFilename(t *testing.T) { - env := awstesting.StashEnv() - defer awstesting.PopEnv(env) - - os.Setenv("HOME", "home_dir") - os.Setenv("USERPROFILE", "profile_dir") - - expect := filepath.Join("home_dir", ".aws", "config") - - name := shareddefaults.SharedConfigFilename() - if e, a := expect, name; e != a { - t.Errorf("expect %q shared config filename, got %q", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go deleted file mode 100644 index afe96b17..00000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_windows_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package shareddefaults_test - -import ( - "os" - "path/filepath" - "testing" - - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -func TestSharedCredsFilename(t *testing.T) { - env := awstesting.StashEnv() - defer awstesting.PopEnv(env) - - os.Setenv("HOME", "home_dir") - os.Setenv("USERPROFILE", "profile_dir") - - expect := filepath.Join("profile_dir", ".aws", "credentials") - - name := shareddefaults.SharedCredentialsFilename() - if e, a := expect, name; e != a { - t.Errorf("expect %q shared creds filename, got %q", e, a) - } -} - -func TestSharedConfigFilename(t *testing.T) { - env := awstesting.StashEnv() - defer awstesting.PopEnv(env) - - os.Setenv("HOME", "home_dir") - os.Setenv("USERPROFILE", "profile_dir") - - expect := filepath.Join("profile_dir", ".aws", "config") - - name := shareddefaults.SharedConfigFilename() - if e, a := expect, name; e != a { - t.Errorf("expect %q shared config filename, got %q", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/README.md b/vendor/github.com/aws/aws-sdk-go/private/README.md deleted file mode 100644 index 5bdb4c50..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/README.md +++ /dev/null @@ -1,4 +0,0 @@ -## AWS SDK for Go Private packages ## -`private` is a collection of packages used internally by the SDK, and is subject to have breaking changes. This package is not `internal` so that if you really need to use its functionality, and understand breaking changes will be made, you are able to. - -These packages will be refactored in the future so that the API generator and model parsers are exposed cleanly on their own. Making it easier for you to generate your own code based on the API models. diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go deleted file mode 100644 index 53831dff..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go +++ /dev/null @@ -1,75 +0,0 @@ -package protocol - -import ( - "crypto/rand" - "fmt" - "reflect" -) - -// RandReader is the random reader the protocol package will use to read -// random bytes from. This is exported for testing, and should not be used. -var RandReader = rand.Reader - -const idempotencyTokenFillTag = `idempotencyToken` - -// CanSetIdempotencyToken returns true if the struct field should be -// automatically populated with a Idempotency token. -// -// Only *string and string type fields that are tagged with idempotencyToken -// which are not already set can be auto filled. -func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool { - switch u := v.Interface().(type) { - // To auto fill an Idempotency token the field must be a string, - // tagged for auto fill, and have a zero value. - case *string: - return u == nil && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 - case string: - return len(u) == 0 && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 - } - - return false -} - -// GetIdempotencyToken returns a randomly generated idempotency token. -func GetIdempotencyToken() string { - b := make([]byte, 16) - RandReader.Read(b) - - return UUIDVersion4(b) -} - -// SetIdempotencyToken will set the value provided with a Idempotency Token. -// Given that the value can be set. Will panic if value is not setable. -func SetIdempotencyToken(v reflect.Value) { - if v.Kind() == reflect.Ptr { - if v.IsNil() && v.CanSet() { - v.Set(reflect.New(v.Type().Elem())) - } - v = v.Elem() - } - v = reflect.Indirect(v) - - if !v.CanSet() { - panic(fmt.Sprintf("unable to set idempotnecy token %v", v)) - } - - b := make([]byte, 16) - _, err := rand.Read(b) - if err != nil { - // TODO handle error - return - } - - v.Set(reflect.ValueOf(UUIDVersion4(b))) -} - -// UUIDVersion4 returns a Version 4 random UUID from the byte slice provided -func UUIDVersion4(u []byte) string { - // https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 - // 13th character is "4" - u[6] = (u[6] | 0x40) & 0x4F - // 17th character is "8", "9", "a", or "b" - u[8] = (u[8] | 0x80) & 0xBF - - return fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency_test.go deleted file mode 100644 index b6ea2356..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency_test.go +++ /dev/null @@ -1,106 +0,0 @@ -package protocol_test - -import ( - "reflect" - "testing" - - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/stretchr/testify/assert" -) - -func TestCanSetIdempotencyToken(t *testing.T) { - cases := []struct { - CanSet bool - Case interface{} - }{ - { - true, - struct { - Field *string `idempotencyToken:"true"` - }{}, - }, - { - true, - struct { - Field string `idempotencyToken:"true"` - }{}, - }, - { - false, - struct { - Field *string `idempotencyToken:"true"` - }{Field: new(string)}, - }, - { - false, - struct { - Field string `idempotencyToken:"true"` - }{Field: "value"}, - }, - { - false, - struct { - Field *int `idempotencyToken:"true"` - }{}, - }, - { - false, - struct { - Field *string - }{}, - }, - } - - for i, c := range cases { - v := reflect.Indirect(reflect.ValueOf(c.Case)) - ty := v.Type() - canSet := protocol.CanSetIdempotencyToken(v.Field(0), ty.Field(0)) - assert.Equal(t, c.CanSet, canSet, "Expect case %d can set to match", i) - } -} - -func TestSetIdempotencyToken(t *testing.T) { - cases := []struct { - Case interface{} - }{ - { - &struct { - Field *string `idempotencyToken:"true"` - }{}, - }, - { - &struct { - Field string `idempotencyToken:"true"` - }{}, - }, - { - &struct { - Field *string `idempotencyToken:"true"` - }{Field: new(string)}, - }, - { - &struct { - Field string `idempotencyToken:"true"` - }{Field: ""}, - }, - } - - for i, c := range cases { - v := reflect.Indirect(reflect.ValueOf(c.Case)) - - protocol.SetIdempotencyToken(v.Field(0)) - assert.NotEmpty(t, v.Field(0).Interface(), "Expect case %d to be set", i) - } -} - -func TestUUIDVersion4(t *testing.T) { - uuid := protocol.UUIDVersion4(make([]byte, 16)) - assert.Equal(t, `00000000-0000-4000-8000-000000000000`, uuid) - - b := make([]byte, 16) - for i := 0; i < len(b); i++ { - b[i] = 1 - } - uuid = protocol.UUIDVersion4(b) - assert.Equal(t, `01010101-0101-4101-8101-010101010101`, uuid) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go deleted file mode 100644 index 6efe43d5..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go +++ /dev/null @@ -1,279 +0,0 @@ -// Package jsonutil provides JSON serialization of AWS requests and responses. -package jsonutil - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/private/protocol" -) - -var timeType = reflect.ValueOf(time.Time{}).Type() -var byteSliceType = reflect.ValueOf([]byte{}).Type() - -// BuildJSON builds a JSON string for a given object v. -func BuildJSON(v interface{}) ([]byte, error) { - var buf bytes.Buffer - - err := buildAny(reflect.ValueOf(v), &buf, "") - return buf.Bytes(), err -} - -func buildAny(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - origVal := value - value = reflect.Indirect(value) - if !value.IsValid() { - return nil - } - - vtype := value.Type() - - t := tag.Get("type") - if t == "" { - switch vtype.Kind() { - case reflect.Struct: - // also it can't be a time object - if value.Type() != timeType { - t = "structure" - } - case reflect.Slice: - // also it can't be a byte slice - if _, ok := value.Interface().([]byte); !ok { - t = "list" - } - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := vtype.FieldByName("_"); ok { - tag = field.Tag - } - return buildStruct(value, buf, tag) - case "list": - return buildList(value, buf, tag) - case "map": - return buildMap(value, buf, tag) - default: - return buildScalar(origVal, buf, tag) - } -} - -func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - if !value.IsValid() { - return nil - } - - // unwrap payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := value.Type().FieldByName(payload) - tag = field.Tag - value = elemOf(value.FieldByName(payload)) - - if !value.IsValid() { - return nil - } - } - - buf.WriteByte('{') - - t := value.Type() - first := true - for i := 0; i < t.NumField(); i++ { - member := value.Field(i) - - // This allocates the most memory. - // Additionally, we cannot skip nil fields due to - // idempotency auto filling. - field := t.Field(i) - - if field.PkgPath != "" { - continue // ignore unexported fields - } - if field.Tag.Get("json") == "-" { - continue - } - if field.Tag.Get("location") != "" { - continue // ignore non-body elements - } - if field.Tag.Get("ignore") != "" { - continue - } - - if protocol.CanSetIdempotencyToken(member, field) { - token := protocol.GetIdempotencyToken() - member = reflect.ValueOf(&token) - } - - if (member.Kind() == reflect.Ptr || member.Kind() == reflect.Slice || member.Kind() == reflect.Map) && member.IsNil() { - continue // ignore unset fields - } - - if first { - first = false - } else { - buf.WriteByte(',') - } - - // figure out what this field is called - name := field.Name - if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - - writeString(name, buf) - buf.WriteString(`:`) - - err := buildAny(member, buf, field.Tag) - if err != nil { - return err - } - - } - - buf.WriteString("}") - - return nil -} - -func buildList(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - buf.WriteString("[") - - for i := 0; i < value.Len(); i++ { - buildAny(value.Index(i), buf, "") - - if i < value.Len()-1 { - buf.WriteString(",") - } - } - - buf.WriteString("]") - - return nil -} - -type sortedValues []reflect.Value - -func (sv sortedValues) Len() int { return len(sv) } -func (sv sortedValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } -func (sv sortedValues) Less(i, j int) bool { return sv[i].String() < sv[j].String() } - -func buildMap(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - buf.WriteString("{") - - sv := sortedValues(value.MapKeys()) - sort.Sort(sv) - - for i, k := range sv { - if i > 0 { - buf.WriteByte(',') - } - - writeString(k.String(), buf) - buf.WriteString(`:`) - - buildAny(value.MapIndex(k), buf, "") - } - - buf.WriteString("}") - - return nil -} - -func buildScalar(v reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - // prevents allocation on the heap. - scratch := [64]byte{} - switch value := reflect.Indirect(v); value.Kind() { - case reflect.String: - writeString(value.String(), buf) - case reflect.Bool: - if value.Bool() { - buf.WriteString("true") - } else { - buf.WriteString("false") - } - case reflect.Int64: - buf.Write(strconv.AppendInt(scratch[:0], value.Int(), 10)) - case reflect.Float64: - f := value.Float() - if math.IsInf(f, 0) || math.IsNaN(f) { - return &json.UnsupportedValueError{Value: v, Str: strconv.FormatFloat(f, 'f', -1, 64)} - } - buf.Write(strconv.AppendFloat(scratch[:0], f, 'f', -1, 64)) - default: - switch value.Type() { - case timeType: - converted := v.Interface().(*time.Time) - - buf.Write(strconv.AppendInt(scratch[:0], converted.UTC().Unix(), 10)) - case byteSliceType: - if !value.IsNil() { - converted := value.Interface().([]byte) - buf.WriteByte('"') - if len(converted) < 1024 { - // for small buffers, using Encode directly is much faster. - dst := make([]byte, base64.StdEncoding.EncodedLen(len(converted))) - base64.StdEncoding.Encode(dst, converted) - buf.Write(dst) - } else { - // for large buffers, avoid unnecessary extra temporary - // buffer space. - enc := base64.NewEncoder(base64.StdEncoding, buf) - enc.Write(converted) - enc.Close() - } - buf.WriteByte('"') - } - default: - return fmt.Errorf("unsupported JSON value %v (%s)", value.Interface(), value.Type()) - } - } - return nil -} - -var hex = "0123456789abcdef" - -func writeString(s string, buf *bytes.Buffer) { - buf.WriteByte('"') - for i := 0; i < len(s); i++ { - if s[i] == '"' { - buf.WriteString(`\"`) - } else if s[i] == '\\' { - buf.WriteString(`\\`) - } else if s[i] == '\b' { - buf.WriteString(`\b`) - } else if s[i] == '\f' { - buf.WriteString(`\f`) - } else if s[i] == '\r' { - buf.WriteString(`\r`) - } else if s[i] == '\t' { - buf.WriteString(`\t`) - } else if s[i] == '\n' { - buf.WriteString(`\n`) - } else if s[i] < 32 { - buf.WriteString("\\u00") - buf.WriteByte(hex[s[i]>>4]) - buf.WriteByte(hex[s[i]&0xF]) - } else { - buf.WriteByte(s[i]) - } - } - buf.WriteByte('"') -} - -// Returns the reflection element of a value, if it is a pointer. -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build_test.go deleted file mode 100644 index e86f4240..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package jsonutil_test - -import ( - "encoding/json" - "testing" - "time" - - "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" - "github.com/stretchr/testify/assert" -) - -func S(s string) *string { - return &s -} - -func D(s int64) *int64 { - return &s -} - -func F(s float64) *float64 { - return &s -} - -func T(s time.Time) *time.Time { - return &s -} - -type J struct { - S *string - SS []string - D *int64 - F *float64 - T *time.Time -} - -var zero = 0.0 - -var jsonTests = []struct { - in interface{} - out string - err string -}{ - { - J{}, - `{}`, - ``, - }, - { - J{ - S: S("str"), - SS: []string{"A", "B", "C"}, - D: D(123), - F: F(4.56), - T: T(time.Unix(987, 0)), - }, - `{"S":"str","SS":["A","B","C"],"D":123,"F":4.56,"T":987}`, - ``, - }, - { - J{ - S: S(`"''"`), - }, - `{"S":"\"''\""}`, - ``, - }, - { - J{ - S: S("\x00føø\u00FF\n\\\"\r\t\b\f"), - }, - `{"S":"\u0000føøÿ\n\\\"\r\t\b\f"}`, - ``, - }, - { - J{ - F: F(4.56 / zero), - }, - "", - `json: unsupported value: +Inf`, - }, -} - -func TestBuildJSON(t *testing.T) { - for _, test := range jsonTests { - out, err := jsonutil.BuildJSON(test.in) - if test.err != "" { - assert.Error(t, err) - assert.Contains(t, err.Error(), test.err) - } else { - assert.NoError(t, err) - assert.Equal(t, string(out), test.out) - } - } -} - -func BenchmarkBuildJSON(b *testing.B) { - for i := 0; i < b.N; i++ { - for _, test := range jsonTests { - jsonutil.BuildJSON(test.in) - } - } -} - -func BenchmarkStdlibJSON(b *testing.B) { - for i := 0; i < b.N; i++ { - for _, test := range jsonTests { - json.Marshal(test.in) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go deleted file mode 100644 index fea53561..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go +++ /dev/null @@ -1,213 +0,0 @@ -package jsonutil - -import ( - "encoding/base64" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "reflect" - "time" -) - -// UnmarshalJSON reads a stream and unmarshals the results in object v. -func UnmarshalJSON(v interface{}, stream io.Reader) error { - var out interface{} - - b, err := ioutil.ReadAll(stream) - if err != nil { - return err - } - - if len(b) == 0 { - return nil - } - - if err := json.Unmarshal(b, &out); err != nil { - return err - } - - return unmarshalAny(reflect.ValueOf(v), out, "") -} - -func unmarshalAny(value reflect.Value, data interface{}, tag reflect.StructTag) error { - vtype := value.Type() - if vtype.Kind() == reflect.Ptr { - vtype = vtype.Elem() // check kind of actual element type - } - - t := tag.Get("type") - if t == "" { - switch vtype.Kind() { - case reflect.Struct: - // also it can't be a time object - if _, ok := value.Interface().(*time.Time); !ok { - t = "structure" - } - case reflect.Slice: - // also it can't be a byte slice - if _, ok := value.Interface().([]byte); !ok { - t = "list" - } - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := vtype.FieldByName("_"); ok { - tag = field.Tag - } - return unmarshalStruct(value, data, tag) - case "list": - return unmarshalList(value, data, tag) - case "map": - return unmarshalMap(value, data, tag) - default: - return unmarshalScalar(value, data, tag) - } -} - -func unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTag) error { - if data == nil { - return nil - } - mapData, ok := data.(map[string]interface{}) - if !ok { - return fmt.Errorf("JSON value is not a structure (%#v)", data) - } - - t := value.Type() - if value.Kind() == reflect.Ptr { - if value.IsNil() { // create the structure if it's nil - s := reflect.New(value.Type().Elem()) - value.Set(s) - value = s - } - - value = value.Elem() - t = t.Elem() - } - - // unwrap any payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := t.FieldByName(payload) - return unmarshalAny(value.FieldByName(payload), data, field.Tag) - } - - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - if field.PkgPath != "" { - continue // ignore unexported fields - } - - // figure out what this field is called - name := field.Name - if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - - member := value.FieldByIndex(field.Index) - err := unmarshalAny(member, mapData[name], field.Tag) - if err != nil { - return err - } - } - return nil -} - -func unmarshalList(value reflect.Value, data interface{}, tag reflect.StructTag) error { - if data == nil { - return nil - } - listData, ok := data.([]interface{}) - if !ok { - return fmt.Errorf("JSON value is not a list (%#v)", data) - } - - if value.IsNil() { - l := len(listData) - value.Set(reflect.MakeSlice(value.Type(), l, l)) - } - - for i, c := range listData { - err := unmarshalAny(value.Index(i), c, "") - if err != nil { - return err - } - } - - return nil -} - -func unmarshalMap(value reflect.Value, data interface{}, tag reflect.StructTag) error { - if data == nil { - return nil - } - mapData, ok := data.(map[string]interface{}) - if !ok { - return fmt.Errorf("JSON value is not a map (%#v)", data) - } - - if value.IsNil() { - value.Set(reflect.MakeMap(value.Type())) - } - - for k, v := range mapData { - kvalue := reflect.ValueOf(k) - vvalue := reflect.New(value.Type().Elem()).Elem() - - unmarshalAny(vvalue, v, "") - value.SetMapIndex(kvalue, vvalue) - } - - return nil -} - -func unmarshalScalar(value reflect.Value, data interface{}, tag reflect.StructTag) error { - errf := func() error { - return fmt.Errorf("unsupported value: %v (%s)", value.Interface(), value.Type()) - } - - switch d := data.(type) { - case nil: - return nil // nothing to do here - case string: - switch value.Interface().(type) { - case *string: - value.Set(reflect.ValueOf(&d)) - case []byte: - b, err := base64.StdEncoding.DecodeString(d) - if err != nil { - return err - } - value.Set(reflect.ValueOf(b)) - default: - return errf() - } - case float64: - switch value.Interface().(type) { - case *int64: - di := int64(d) - value.Set(reflect.ValueOf(&di)) - case *float64: - value.Set(reflect.ValueOf(&d)) - case *time.Time: - t := time.Unix(int64(d), 0).UTC() - value.Set(reflect.ValueOf(&t)) - default: - return errf() - } - case bool: - switch value.Interface().(type) { - case *bool: - value.Set(reflect.ValueOf(&d)) - default: - return errf() - } - default: - return fmt.Errorf("unsupported JSON value (%v)", data) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_bench_test.go deleted file mode 100644 index 563caa05..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_bench_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// +build bench - -package jsonrpc_test - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" -) - -func BenchmarkJSONRPCBuild_Simple_dynamodbPutItem(b *testing.B) { - svc := awstesting.NewClient() - - params := getDynamodbPutItemParams(b) - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil) - jsonrpc.Build(r) - if r.Error != nil { - b.Fatal("Unexpected error", r.Error) - } - } -} - -func BenchmarkJSONUtilBuild_Simple_dynamodbPutItem(b *testing.B) { - svc := awstesting.NewClient() - - params := getDynamodbPutItemParams(b) - - for i := 0; i < b.N; i++ { - r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil) - _, err := jsonutil.BuildJSON(r.Params) - if err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func BenchmarkEncodingJSONMarshal_Simple_dynamodbPutItem(b *testing.B) { - params := getDynamodbPutItemParams(b) - - for i := 0; i < b.N; i++ { - buf := &bytes.Buffer{} - encoder := json.NewEncoder(buf) - if err := encoder.Encode(params); err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func getDynamodbPutItemParams(b *testing.B) *dynamodb.PutItemInput { - av, err := dynamodbattribute.ConvertToMap(struct { - Key string - Data string - }{Key: "MyKey", Data: "MyData"}) - if err != nil { - b.Fatal("benchPutItem, expect no ConvertToMap errors", err) - } - return &dynamodb.PutItemInput{ - Item: av, - TableName: aws.String("tablename"), - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_test.go deleted file mode 100644 index e1bd3cd7..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/build_test.go +++ /dev/null @@ -1,2155 +0,0 @@ -package jsonrpc_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/util" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String -var _ = fmt.Println -var _ = reflect.Value{} - -func init() { - protocol.RandReader = &awstesting.ZeroReader{} -} - -// InputService1ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService1ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService1TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService1TestCaseOperation1 for more information on using the InputService1TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService1TestCaseOperation1Request method. -// req, resp := client.InputService1TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation1Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService1TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService1TestCaseOperation1 for usage and error information. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService1TestCaseOperation1WithContext is the same as InputService1TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService1TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation1Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService1TestShapeInputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Name *string `type:"string"` -} - -// SetName sets the Name field's value. -func (s *InputService1TestShapeInputService1TestCaseOperation1Input) SetName(v string) *InputService1TestShapeInputService1TestCaseOperation1Input { - s.Name = &v - return s -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService2ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService2ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService2TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService2TestCaseOperation1 for more information on using the InputService2TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService2TestCaseOperation1Request method. -// req, resp := client.InputService2TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService2TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService2TestCaseOperation1 for usage and error information. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService2TestCaseOperation1WithContext is the same as InputService2TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService2TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1WithContext(ctx aws.Context, input *InputService2TestShapeInputService2TestCaseOperation1Input, opts ...request.Option) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `type:"timestamp" timestampFormat:"unix"` -} - -// SetTimeArg sets the TimeArg field's value. -func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetTimeArg(v time.Time) *InputService2TestShapeInputService2TestCaseOperation1Input { - s.TimeArg = &v - return s -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService3ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService3ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService3TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService3TestCaseOperation1 for more information on using the InputService3TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService3TestCaseOperation1Request method. -// req, resp := client.InputService3TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation2Input{} - } - - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService3TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService3TestCaseOperation1 for usage and error information. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService3TestCaseOperation1WithContext is the same as InputService3TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService3TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService3TestCaseOperation2 = "OperationName" - -// InputService3TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService3TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService3TestCaseOperation2 for more information on using the InputService3TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService3TestCaseOperation2Request method. -// req, resp := client.InputService3TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation2Input{} - } - - output = &InputService3TestShapeInputService3TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService3TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService3TestCaseOperation2 for usage and error information. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { - req, out := c.InputService3TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService3TestCaseOperation2WithContext is the same as InputService3TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService3TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { - req, out := c.InputService3TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputService3TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - // BlobArg is automatically base64 encoded/decoded by the SDK. - BlobArg []byte `type:"blob"` - - BlobMap map[string][]byte `type:"map"` -} - -// SetBlobArg sets the BlobArg field's value. -func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetBlobArg(v []byte) *InputService3TestShapeInputService3TestCaseOperation2Input { - s.BlobArg = v - return s -} - -// SetBlobMap sets the BlobMap field's value. -func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetBlobMap(v map[string][]byte) *InputService3TestShapeInputService3TestCaseOperation2Input { - s.BlobMap = v - return s -} - -type InputService3TestShapeInputService3TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService4ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService4ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService4TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService4TestCaseOperation1 for more information on using the InputService4TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService4TestCaseOperation1Request method. -// req, resp := client.InputService4TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} - } - - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService4TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService4TestCaseOperation1 for usage and error information. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService4TestCaseOperation1WithContext is the same as InputService4TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService4TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1WithContext(ctx aws.Context, input *InputService4TestShapeInputService4TestCaseOperation1Input, opts ...request.Option) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService4TestShapeInputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListParam [][]byte `type:"list"` -} - -// SetListParam sets the ListParam field's value. -func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetListParam(v [][]byte) *InputService4TestShapeInputService4TestCaseOperation1Input { - s.ListParam = v - return s -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService5ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService5ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation1 for more information on using the InputService5TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation1Request method. -// req, resp := client.InputService5TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation6Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation6Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation1 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation6Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation1WithContext is the same as InputService5TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation6Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService5TestCaseOperation2 = "OperationName" - -// InputService5TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation2 for more information on using the InputService5TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation2Request method. -// req, resp := client.InputService5TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation2Request(input *InputService5TestShapeInputService5TestCaseOperation6Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation6Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation2 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation2(input *InputService5TestShapeInputService5TestCaseOperation6Input) (*InputService5TestShapeInputService5TestCaseOperation2Output, error) { - req, out := c.InputService5TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation2WithContext is the same as InputService5TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation2WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation6Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation2Output, error) { - req, out := c.InputService5TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService5TestCaseOperation3 = "OperationName" - -// InputService5TestCaseOperation3Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation3 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation3 for more information on using the InputService5TestCaseOperation3 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation3Request method. -// req, resp := client.InputService5TestCaseOperation3Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation3Request(input *InputService5TestShapeInputService5TestCaseOperation6Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation3, - HTTPPath: "/", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation6Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation3 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation3 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation3(input *InputService5TestShapeInputService5TestCaseOperation6Input) (*InputService5TestShapeInputService5TestCaseOperation3Output, error) { - req, out := c.InputService5TestCaseOperation3Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation3WithContext is the same as InputService5TestCaseOperation3 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation3 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation3WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation6Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation3Output, error) { - req, out := c.InputService5TestCaseOperation3Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService5TestCaseOperation4 = "OperationName" - -// InputService5TestCaseOperation4Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation4 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation4 for more information on using the InputService5TestCaseOperation4 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation4Request method. -// req, resp := client.InputService5TestCaseOperation4Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation4Request(input *InputService5TestShapeInputService5TestCaseOperation6Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation4, - HTTPPath: "/", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation6Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation4Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation4 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation4 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation4(input *InputService5TestShapeInputService5TestCaseOperation6Input) (*InputService5TestShapeInputService5TestCaseOperation4Output, error) { - req, out := c.InputService5TestCaseOperation4Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation4WithContext is the same as InputService5TestCaseOperation4 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation4 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation4WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation6Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation4Output, error) { - req, out := c.InputService5TestCaseOperation4Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService5TestCaseOperation5 = "OperationName" - -// InputService5TestCaseOperation5Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation5 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation5 for more information on using the InputService5TestCaseOperation5 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation5Request method. -// req, resp := client.InputService5TestCaseOperation5Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation5Request(input *InputService5TestShapeInputService5TestCaseOperation6Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation5, - HTTPPath: "/", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation6Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation5Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation5 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation5 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation5(input *InputService5TestShapeInputService5TestCaseOperation6Input) (*InputService5TestShapeInputService5TestCaseOperation5Output, error) { - req, out := c.InputService5TestCaseOperation5Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation5WithContext is the same as InputService5TestCaseOperation5 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation5 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation5WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation6Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation5Output, error) { - req, out := c.InputService5TestCaseOperation5Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService5TestCaseOperation6 = "OperationName" - -// InputService5TestCaseOperation6Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation6 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation6 for more information on using the InputService5TestCaseOperation6 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation6Request method. -// req, resp := client.InputService5TestCaseOperation6Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation6Request(input *InputService5TestShapeInputService5TestCaseOperation6Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation6, - HTTPPath: "/", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation6Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation6Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation6 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation6 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation6(input *InputService5TestShapeInputService5TestCaseOperation6Input) (*InputService5TestShapeInputService5TestCaseOperation6Output, error) { - req, out := c.InputService5TestCaseOperation6Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation6WithContext is the same as InputService5TestCaseOperation6 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation6 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation6WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation6Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation6Output, error) { - req, out := c.InputService5TestCaseOperation6Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation6Input struct { - _ struct{} `type:"structure"` - - RecursiveStruct *InputService5TestShapeRecursiveStructType `type:"structure"` -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService5TestShapeInputService5TestCaseOperation6Input) SetRecursiveStruct(v *InputService5TestShapeRecursiveStructType) *InputService5TestShapeInputService5TestCaseOperation6Input { - s.RecursiveStruct = v - return s -} - -type InputService5TestShapeInputService5TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService5TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService5TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService5TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService5TestShapeRecursiveStructType `type:"structure"` -} - -// SetNoRecurse sets the NoRecurse field's value. -func (s *InputService5TestShapeRecursiveStructType) SetNoRecurse(v string) *InputService5TestShapeRecursiveStructType { - s.NoRecurse = &v - return s -} - -// SetRecursiveList sets the RecursiveList field's value. -func (s *InputService5TestShapeRecursiveStructType) SetRecursiveList(v []*InputService5TestShapeRecursiveStructType) *InputService5TestShapeRecursiveStructType { - s.RecursiveList = v - return s -} - -// SetRecursiveMap sets the RecursiveMap field's value. -func (s *InputService5TestShapeRecursiveStructType) SetRecursiveMap(v map[string]*InputService5TestShapeRecursiveStructType) *InputService5TestShapeRecursiveStructType { - s.RecursiveMap = v - return s -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService5TestShapeRecursiveStructType) SetRecursiveStruct(v *InputService5TestShapeRecursiveStructType) *InputService5TestShapeRecursiveStructType { - s.RecursiveStruct = v - return s -} - -// InputService6ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService6ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - JSONVersion: "1.1", - TargetPrefix: "com.amazonaws.foo", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService6TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService6TestCaseOperation1 for more information on using the InputService6TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService6TestCaseOperation1Request method. -// req, resp := client.InputService6TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService6TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService6TestCaseOperation1 for usage and error information. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService6TestCaseOperation1WithContext is the same as InputService6TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService6TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1WithContext(ctx aws.Context, input *InputService6TestShapeInputService6TestCaseOperation1Input, opts ...request.Option) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Map map[string]*string `type:"map"` -} - -// SetMap sets the Map field's value. -func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetMap(v map[string]*string) *InputService6TestShapeInputService6TestCaseOperation1Input { - s.Map = v - return s -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService7ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService7ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService7ProtocolTest client from just a session. -// svc := inputservice7protocoltest.New(mySession) -// -// // Create a InputService7ProtocolTest client with additional configuration -// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { - c := p.ClientConfig("inputservice7protocoltest", cfgs...) - return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService7ProtocolTest { - svc := &InputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice7protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService7TestCaseOperation1 = "OperationName" - -// InputService7TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService7TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService7TestCaseOperation1 for more information on using the InputService7TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService7TestCaseOperation1Request method. -// req, resp := client.InputService7TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation2Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation2Input{} - } - - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService7TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService7TestCaseOperation1 for usage and error information. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation2Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService7TestCaseOperation1WithContext is the same as InputService7TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService7TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1WithContext(ctx aws.Context, input *InputService7TestShapeInputService7TestCaseOperation2Input, opts ...request.Option) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService7TestCaseOperation2 = "OperationName" - -// InputService7TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService7TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService7TestCaseOperation2 for more information on using the InputService7TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService7TestCaseOperation2Request method. -// req, resp := client.InputService7TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService7ProtocolTest) InputService7TestCaseOperation2Request(input *InputService7TestShapeInputService7TestCaseOperation2Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation2Input{} - } - - output = &InputService7TestShapeInputService7TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService7TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService7TestCaseOperation2 for usage and error information. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation2(input *InputService7TestShapeInputService7TestCaseOperation2Input) (*InputService7TestShapeInputService7TestCaseOperation2Output, error) { - req, out := c.InputService7TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService7TestCaseOperation2WithContext is the same as InputService7TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService7TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation2WithContext(ctx aws.Context, input *InputService7TestShapeInputService7TestCaseOperation2Input, opts ...request.Option) (*InputService7TestShapeInputService7TestCaseOperation2Output, error) { - req, out := c.InputService7TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService7TestShapeInputService7TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - Token *string `type:"string" idempotencyToken:"true"` -} - -// SetToken sets the Token field's value. -func (s *InputService7TestShapeInputService7TestCaseOperation2Input) SetToken(v string) *InputService7TestShapeInputService7TestCaseOperation2Input { - s.Token = &v - return s -} - -type InputService7TestShapeInputService7TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation1Input{ - Name: aws.String("myname"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Name":"myname"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"TimeArg":1422172800}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService3ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation2Input{ - BlobArg: []byte("foo"), - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"BlobArg":"Zm9v"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) { - svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation2Input{ - BlobMap: map[string][]byte{ - "key1": []byte("foo"), - "key2": []byte("bar"), - }, - } - req, _ := svc.InputService3TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"BlobMap":{"key1":"Zm9v","key2":"YmFy"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ - ListParam: [][]byte{ - []byte("foo"), - []byte("bar"), - }, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"ListParam":["Zm9v","YmFy"]}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation6Input{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"NoRecurse":"foo"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService5ProtocolTestRecursiveShapesCase2(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation6Input{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService5TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService5ProtocolTestRecursiveShapesCase3(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation6Input{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService5ProtocolTestRecursiveShapesCase4(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation6Input{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveList: []*InputService5TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"NoRecurse":"bar"}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService5ProtocolTestRecursiveShapesCase5(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation6Input{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveList: []*InputService5TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"RecursiveStruct":{"NoRecurse":"bar"}}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService5ProtocolTestRecursiveShapesCase6(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation6Input{ - RecursiveStruct: &InputService5TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService5TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService5TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService6ProtocolTestEmptyMapsCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - Map: map[string]*string{}, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Map":{}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService7TestShapeInputService7TestCaseOperation2Input{ - Token: aws.String("abc123"), - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Token":"abc123"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService7TestShapeInputService7TestCaseOperation2Input{} - req, _ := svc.InputService7TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - jsonrpc.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Token":"00000000-0000-4000-8000-000000000000"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go deleted file mode 100644 index 56af4dc4..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go +++ /dev/null @@ -1,111 +0,0 @@ -// Package jsonrpc provides JSON RPC utilities for serialization of AWS -// requests and responses. -package jsonrpc - -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/json.json build_test.go -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/json.json unmarshal_test.go - -import ( - "encoding/json" - "io/ioutil" - "strings" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -var emptyJSON = []byte("{}") - -// BuildHandler is a named request handler for building jsonrpc protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Build", Fn: Build} - -// UnmarshalHandler is a named request handler for unmarshaling jsonrpc protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling jsonrpc protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalMeta", Fn: UnmarshalMeta} - -// UnmarshalErrorHandler is a named request handler for unmarshaling jsonrpc protocol request errors -var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalError", Fn: UnmarshalError} - -// Build builds a JSON payload for a JSON RPC request. -func Build(req *request.Request) { - var buf []byte - var err error - if req.ParamsFilled() { - buf, err = jsonutil.BuildJSON(req.Params) - if err != nil { - req.Error = awserr.New("SerializationError", "failed encoding JSON RPC request", err) - return - } - } else { - buf = emptyJSON - } - - if req.ClientInfo.TargetPrefix != "" || string(buf) != "{}" { - req.SetBufferBody(buf) - } - - if req.ClientInfo.TargetPrefix != "" { - target := req.ClientInfo.TargetPrefix + "." + req.Operation.Name - req.HTTPRequest.Header.Add("X-Amz-Target", target) - } - if req.ClientInfo.JSONVersion != "" { - jsonVersion := req.ClientInfo.JSONVersion - req.HTTPRequest.Header.Add("Content-Type", "application/x-amz-json-"+jsonVersion) - } -} - -// Unmarshal unmarshals a response for a JSON RPC service. -func Unmarshal(req *request.Request) { - defer req.HTTPResponse.Body.Close() - if req.DataFilled() { - err := jsonutil.UnmarshalJSON(req.Data, req.HTTPResponse.Body) - if err != nil { - req.Error = awserr.New("SerializationError", "failed decoding JSON RPC response", err) - } - } - return -} - -// UnmarshalMeta unmarshals headers from a response for a JSON RPC service. -func UnmarshalMeta(req *request.Request) { - rest.UnmarshalMeta(req) -} - -// UnmarshalError unmarshals an error response for a JSON RPC service. -func UnmarshalError(req *request.Request) { - defer req.HTTPResponse.Body.Close() - bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) - if err != nil { - req.Error = awserr.New("SerializationError", "failed reading JSON RPC error response", err) - return - } - if len(bodyBytes) == 0 { - req.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", req.HTTPResponse.Status, nil), - req.HTTPResponse.StatusCode, - "", - ) - return - } - var jsonErr jsonErrorResponse - if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { - req.Error = awserr.New("SerializationError", "failed decoding JSON RPC error response", err) - return - } - - codes := strings.SplitN(jsonErr.Code, "#", 2) - req.Error = awserr.NewRequestFailure( - awserr.New(codes[len(codes)-1], jsonErr.Message, nil), - req.HTTPResponse.StatusCode, - req.RequestID, - ) -} - -type jsonErrorResponse struct { - Code string `json:"__type"` - Message string `json:"message"` -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/unmarshal_test.go deleted file mode 100644 index e3eb8e58..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/unmarshal_test.go +++ /dev/null @@ -1,1330 +0,0 @@ -package jsonrpc_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/util" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String -var _ = fmt.Println -var _ = reflect.Value{} - -func init() { - protocol.RandReader = &awstesting.ZeroReader{} -} - -// OutputService1ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService1ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService1TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService1TestCaseOperation1 for more information on using the OutputService1TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService1TestCaseOperation1Request method. -// req, resp := client.OutputService1TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService1TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService1TestCaseOperation1 for usage and error information. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService1TestCaseOperation1WithContext is the same as OutputService1TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService1TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation1Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - Long *int64 `type:"long"` - - Num *int64 `type:"integer"` - - Str *string `type:"string"` - - TrueBool *bool `type:"boolean"` -} - -// SetChar sets the Char field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetChar(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Char = &v - return s -} - -// SetDouble sets the Double field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetDouble(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Double = &v - return s -} - -// SetFalseBool sets the FalseBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFalseBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.FalseBool = &v - return s -} - -// SetFloat sets the Float field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFloat(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Float = &v - return s -} - -// SetLong sets the Long field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetLong(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Long = &v - return s -} - -// SetNum sets the Num field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetNum(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Num = &v - return s -} - -// SetStr sets the Str field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetStr(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Str = &v - return s -} - -// SetTrueBool sets the TrueBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetTrueBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.TrueBool = &v - return s -} - -// OutputService2ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService2ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService2TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService2TestCaseOperation1 for more information on using the OutputService2TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService2TestCaseOperation1Request method. -// req, resp := client.OutputService2TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService2TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService2TestCaseOperation1 for usage and error information. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService2TestCaseOperation1WithContext is the same as OutputService2TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService2TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1WithContext(ctx aws.Context, input *OutputService2TestShapeOutputService2TestCaseOperation1Input, opts ...request.Option) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService2TestShapeBlobContainer struct { - _ struct{} `type:"structure"` - - // Foo is automatically base64 encoded/decoded by the SDK. - Foo []byte `locationName:"foo" type:"blob"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService2TestShapeBlobContainer) SetFoo(v []byte) *OutputService2TestShapeBlobContainer { - s.Foo = v - return s -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - // BlobMember is automatically base64 encoded/decoded by the SDK. - BlobMember []byte `type:"blob"` - - StructMember *OutputService2TestShapeBlobContainer `type:"structure"` -} - -// SetBlobMember sets the BlobMember field's value. -func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetBlobMember(v []byte) *OutputService2TestShapeOutputService2TestCaseOperation1Output { - s.BlobMember = v - return s -} - -// SetStructMember sets the StructMember field's value. -func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetStructMember(v *OutputService2TestShapeBlobContainer) *OutputService2TestShapeOutputService2TestCaseOperation1Output { - s.StructMember = v - return s -} - -// OutputService3ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService3ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService3TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService3TestCaseOperation1 for more information on using the OutputService3TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService3TestCaseOperation1Request method. -// req, resp := client.OutputService3TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService3TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService3TestCaseOperation1 for usage and error information. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService3TestCaseOperation1WithContext is the same as OutputService3TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService3TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1WithContext(ctx aws.Context, input *OutputService3TestShapeOutputService3TestCaseOperation1Input, opts ...request.Option) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StructMember *OutputService3TestShapeTimeContainer `type:"structure"` - - TimeMember *time.Time `type:"timestamp" timestampFormat:"unix"` -} - -// SetStructMember sets the StructMember field's value. -func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetStructMember(v *OutputService3TestShapeTimeContainer) *OutputService3TestShapeOutputService3TestCaseOperation1Output { - s.StructMember = v - return s -} - -// SetTimeMember sets the TimeMember field's value. -func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetTimeMember(v time.Time) *OutputService3TestShapeOutputService3TestCaseOperation1Output { - s.TimeMember = &v - return s -} - -type OutputService3TestShapeTimeContainer struct { - _ struct{} `type:"structure"` - - Foo *time.Time `locationName:"foo" type:"timestamp" timestampFormat:"unix"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService3TestShapeTimeContainer) SetFoo(v time.Time) *OutputService3TestShapeTimeContainer { - s.Foo = &v - return s -} - -// OutputService4ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService4ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService4TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService4TestCaseOperation1 for more information on using the OutputService4TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService4TestCaseOperation1Request method. -// req, resp := client.OutputService4TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation2Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - output = &OutputService4TestShapeOutputService4TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService4TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService4TestCaseOperation1 for usage and error information. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation2Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService4TestCaseOperation1WithContext is the same as OutputService4TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService4TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1WithContext(ctx aws.Context, input *OutputService4TestShapeOutputService4TestCaseOperation1Input, opts ...request.Option) (*OutputService4TestShapeOutputService4TestCaseOperation2Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opOutputService4TestCaseOperation2 = "OperationName" - -// OutputService4TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the OutputService4TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService4TestCaseOperation2 for more information on using the OutputService4TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService4TestCaseOperation2Request method. -// req, resp := client.OutputService4TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2Request(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation2Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation2Input{} - } - - output = &OutputService4TestShapeOutputService4TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService4TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService4TestCaseOperation2 for usage and error information. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (*OutputService4TestShapeOutputService4TestCaseOperation2Output, error) { - req, out := c.OutputService4TestCaseOperation2Request(input) - return out, req.Send() -} - -// OutputService4TestCaseOperation2WithContext is the same as OutputService4TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService4TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2WithContext(ctx aws.Context, input *OutputService4TestShapeOutputService4TestCaseOperation2Input, opts ...request.Option) (*OutputService4TestShapeOutputService4TestCaseOperation2Output, error) { - req, out := c.OutputService4TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation2Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation2Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` - - ListMemberMap []map[string]*string `type:"list"` - - ListMemberStruct []*OutputService4TestShapeStructType `type:"list"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService4TestShapeOutputService4TestCaseOperation2Output) SetListMember(v []*string) *OutputService4TestShapeOutputService4TestCaseOperation2Output { - s.ListMember = v - return s -} - -// SetListMemberMap sets the ListMemberMap field's value. -func (s *OutputService4TestShapeOutputService4TestCaseOperation2Output) SetListMemberMap(v []map[string]*string) *OutputService4TestShapeOutputService4TestCaseOperation2Output { - s.ListMemberMap = v - return s -} - -// SetListMemberStruct sets the ListMemberStruct field's value. -func (s *OutputService4TestShapeOutputService4TestCaseOperation2Output) SetListMemberStruct(v []*OutputService4TestShapeStructType) *OutputService4TestShapeOutputService4TestCaseOperation2Output { - s.ListMemberStruct = v - return s -} - -type OutputService4TestShapeStructType struct { - _ struct{} `type:"structure"` -} - -// OutputService5ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService5ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService5TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService5TestCaseOperation1 for more information on using the OutputService5TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService5TestCaseOperation1Request method. -// req, resp := client.OutputService5TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService5TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService5TestCaseOperation1 for usage and error information. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService5TestCaseOperation1WithContext is the same as OutputService5TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService5TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1WithContext(ctx aws.Context, input *OutputService5TestShapeOutputService5TestCaseOperation1Input, opts ...request.Option) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - MapMember map[string][]*int64 `type:"map"` -} - -// SetMapMember sets the MapMember field's value. -func (s *OutputService5TestShapeOutputService5TestCaseOperation1Output) SetMapMember(v map[string][]*int64) *OutputService5TestShapeOutputService5TestCaseOperation1Output { - s.MapMember = v - return s -} - -// OutputService6ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService6ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService6TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService6TestCaseOperation1 for more information on using the OutputService6TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService6TestCaseOperation1Request method. -// req, resp := client.OutputService6TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService6TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService6TestCaseOperation1 for usage and error information. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService6TestCaseOperation1WithContext is the same as OutputService6TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService6TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1WithContext(ctx aws.Context, input *OutputService6TestShapeOutputService6TestCaseOperation1Input, opts ...request.Option) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StrType *string `type:"string"` -} - -// SetStrType sets the StrType field's value. -func (s *OutputService6TestShapeOutputService6TestCaseOperation1Output) SetStrType(v string) *OutputService6TestShapeOutputService6TestCaseOperation1Output { - s.StrType = &v - return s -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.Char; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := 1.3, *out.Double; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := false, *out.FalseBool; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := 1.2, *out.Float; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(200), *out.Long; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(123), *out.Num; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "myname", *out.Str; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := true, *out.TrueBool; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "hi!", string(out.BlobMember); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "there!", string(out.StructMember.Foo); e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { - svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.ListMember[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "b", *out.ListMember[1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService4ProtocolTestListsCase2(t *testing.T) { - svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", null], \"ListMemberMap\": [{}, null, null, {}], \"ListMemberStruct\": [{}, null, null, {}]}")) - req, out := svc.OutputService4TestCaseOperation2Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.ListMember[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e := out.ListMember[1]; e != nil { - t.Errorf("expect nil, got %v", e) - } - if e := out.ListMemberMap[1]; e != nil { - t.Errorf("expect nil, got %v", e) - } - if e := out.ListMemberMap[2]; e != nil { - t.Errorf("expect nil, got %v", e) - } - if e := out.ListMemberStruct[1]; e != nil { - t.Errorf("expect nil, got %v", e) - } - if e := out.ListMemberStruct[2]; e != nil { - t.Errorf("expect nil, got %v", e) - } - -} - -func TestOutputService5ProtocolTestMapsCase1(t *testing.T) { - svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := int64(1), *out.MapMember["a"][0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(2), *out.MapMember["a"][1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(3), *out.MapMember["b"][0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(4), *out.MapMember["b"][1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService6ProtocolTestIgnoresExtraDataCase1(t *testing.T) { - svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - jsonrpc.UnmarshalMeta(req) - jsonrpc.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol_test.go deleted file mode 100644 index eb2e155b..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol_test.go +++ /dev/null @@ -1,203 +0,0 @@ -package protocol_test - -import ( - "net/http" - "net/url" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/ec2query" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/query" - "github.com/aws/aws-sdk-go/private/protocol/rest" - "github.com/aws/aws-sdk-go/private/protocol/restjson" - "github.com/aws/aws-sdk-go/private/protocol/restxml" -) - -func xmlData(set bool, b []byte, size, delta int) { - const openingTags = "" - const closingTags = "" - if !set { - copy(b, []byte(openingTags)) - } - if size == 0 { - copy(b[delta-len(closingTags):], []byte(closingTags)) - } -} - -func jsonData(set bool, b []byte, size, delta int) { - if !set { - copy(b, []byte("{\"A\": \"")) - } - if size == 0 { - copy(b[delta-len("\"}"):], []byte("\"}")) - } -} - -func buildNewRequest(data interface{}) *request.Request { - v := url.Values{} - v.Set("test", "TEST") - v.Add("test1", "TEST1") - - req := &request.Request{ - HTTPRequest: &http.Request{ - Header: make(http.Header), - Body: &awstesting.ReadCloser{Size: 2048}, - URL: &url.URL{ - RawQuery: v.Encode(), - }, - }, - Params: &struct { - LocationName string `locationName:"test"` - }{ - "Test", - }, - ClientInfo: metadata.ClientInfo{ - ServiceName: "test", - TargetPrefix: "test", - JSONVersion: "test", - APIVersion: "test", - Endpoint: "test", - SigningName: "test", - SigningRegion: "test", - }, - Operation: &request.Operation{ - Name: "test", - }, - } - req.HTTPResponse = &http.Response{ - Body: &awstesting.ReadCloser{Size: 2048}, - Header: http.Header{ - "X-Amzn-Requestid": []string{"1"}, - }, - StatusCode: http.StatusOK, - } - - if data == nil { - data = &struct { - _ struct{} `type:"structure"` - LocationName *string `locationName:"testName"` - Location *string `location:"statusCode"` - A *string `type:"string"` - }{} - } - - req.Data = data - - return req -} - -type expected struct { - dataType int - closed bool - size int - errExists bool -} - -const ( - jsonType = iota - xmlType -) - -func checkForLeak(data interface{}, build, fn func(*request.Request), t *testing.T, result expected) { - req := buildNewRequest(data) - reader := req.HTTPResponse.Body.(*awstesting.ReadCloser) - switch result.dataType { - case jsonType: - reader.FillData = jsonData - case xmlType: - reader.FillData = xmlData - } - build(req) - fn(req) - - if result.errExists { - assert.NotNil(t, req.Error) - } else { - assert.Nil(t, req.Error) - } - - assert.Equal(t, reader.Closed, result.closed) - assert.Equal(t, reader.Size, result.size) -} - -func TestJSONRpc(t *testing.T) { - checkForLeak(nil, jsonrpc.Build, jsonrpc.Unmarshal, t, expected{jsonType, true, 0, false}) - checkForLeak(nil, jsonrpc.Build, jsonrpc.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) - checkForLeak(nil, jsonrpc.Build, jsonrpc.UnmarshalError, t, expected{jsonType, true, 0, true}) -} - -func TestQuery(t *testing.T) { - checkForLeak(nil, query.Build, query.Unmarshal, t, expected{jsonType, true, 0, false}) - checkForLeak(nil, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) - checkForLeak(nil, query.Build, query.UnmarshalError, t, expected{jsonType, true, 0, true}) -} - -func TestRest(t *testing.T) { - // case 1: Payload io.ReadSeeker - checkForLeak(nil, rest.Build, rest.Unmarshal, t, expected{jsonType, false, 2048, false}) - checkForLeak(nil, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) - - // case 2: Payload *string - // should close the body - dataStr := struct { - _ struct{} `type:"structure" payload:"Payload"` - LocationName *string `locationName:"testName"` - Location *string `location:"statusCode"` - A *string `type:"string"` - Payload *string `locationName:"payload" type:"blob" required:"true"` - }{} - checkForLeak(&dataStr, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, false}) - checkForLeak(&dataStr, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) - - // case 3: Payload []byte - // should close the body - dataBytes := struct { - _ struct{} `type:"structure" payload:"Payload"` - LocationName *string `locationName:"testName"` - Location *string `location:"statusCode"` - A *string `type:"string"` - Payload []byte `locationName:"payload" type:"blob" required:"true"` - }{} - checkForLeak(&dataBytes, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, false}) - checkForLeak(&dataBytes, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) - - // case 4: Payload unsupported type - // should close the body - dataUnsupported := struct { - _ struct{} `type:"structure" payload:"Payload"` - LocationName *string `locationName:"testName"` - Location *string `location:"statusCode"` - A *string `type:"string"` - Payload string `locationName:"payload" type:"blob" required:"true"` - }{} - checkForLeak(&dataUnsupported, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, true}) - checkForLeak(&dataUnsupported, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) -} - -func TestRestJSON(t *testing.T) { - checkForLeak(nil, restjson.Build, restjson.Unmarshal, t, expected{jsonType, true, 0, false}) - checkForLeak(nil, restjson.Build, restjson.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) - checkForLeak(nil, restjson.Build, restjson.UnmarshalError, t, expected{jsonType, true, 0, true}) -} - -func TestRestXML(t *testing.T) { - checkForLeak(nil, restxml.Build, restxml.Unmarshal, t, expected{xmlType, true, 0, false}) - checkForLeak(nil, restxml.Build, restxml.UnmarshalMeta, t, expected{xmlType, false, 2048, false}) - checkForLeak(nil, restxml.Build, restxml.UnmarshalError, t, expected{xmlType, true, 0, true}) -} - -func TestXML(t *testing.T) { - checkForLeak(nil, ec2query.Build, ec2query.Unmarshal, t, expected{jsonType, true, 0, false}) - checkForLeak(nil, ec2query.Build, ec2query.UnmarshalMeta, t, expected{jsonType, false, 2048, false}) - checkForLeak(nil, ec2query.Build, ec2query.UnmarshalError, t, expected{jsonType, true, 0, true}) -} - -func TestProtocol(t *testing.T) { - checkForLeak(nil, restxml.Build, protocol.UnmarshalDiscardBody, t, expected{xmlType, true, 0, false}) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go deleted file mode 100644 index 18169f0f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go +++ /dev/null @@ -1,36 +0,0 @@ -// Package query provides serialization of AWS query requests, and responses. -package query - -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go - -import ( - "net/url" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" -) - -// BuildHandler is a named request handler for building query protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} - -// Build builds a request for an AWS Query service. -func Build(r *request.Request) { - body := url.Values{ - "Action": {r.Operation.Name}, - "Version": {r.ClientInfo.APIVersion}, - } - if err := queryutil.Parse(body, r.Params, false); err != nil { - r.Error = awserr.New("SerializationError", "failed encoding Query request", err) - return - } - - if r.ExpireTime == 0 { - r.HTTPRequest.Method = "POST" - r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") - r.SetBufferBody([]byte(body.Encode())) - } else { // This is a pre-signed request - r.HTTPRequest.Method = "GET" - r.HTTPRequest.URL.RawQuery = body.Encode() - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go deleted file mode 100644 index f9990923..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go +++ /dev/null @@ -1,3657 +0,0 @@ -package query_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/query" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/util" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String -var _ = fmt.Println -var _ = reflect.Value{} - -func init() { - protocol.RandReader = &awstesting.ZeroReader{} -} - -// InputService1ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService1ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService1TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService1TestCaseOperation1 for more information on using the InputService1TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService1TestCaseOperation1Request method. -// req, resp := client.InputService1TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation3Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService1TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService1TestCaseOperation1 for usage and error information. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService1TestCaseOperation1WithContext is the same as InputService1TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService1TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation3Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService1TestCaseOperation2 = "OperationName" - -// InputService1TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService1TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService1TestCaseOperation2 for more information on using the InputService1TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService1TestCaseOperation2Request method. -// req, resp := client.InputService1TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation3Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService1TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService1TestCaseOperation2 for usage and error information. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) { - req, out := c.InputService1TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService1TestCaseOperation2WithContext is the same as InputService1TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService1TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation3Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation2Output, error) { - req, out := c.InputService1TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService1TestCaseOperation3 = "OperationName" - -// InputService1TestCaseOperation3Request generates a "aws/request.Request" representing the -// client's request for the InputService1TestCaseOperation3 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService1TestCaseOperation3 for more information on using the InputService1TestCaseOperation3 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService1TestCaseOperation3Request method. -// req, resp := client.InputService1TestCaseOperation3Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService1ProtocolTest) InputService1TestCaseOperation3Request(input *InputService1TestShapeInputService1TestCaseOperation3Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation3, - HTTPPath: "/", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation3Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService1TestCaseOperation3 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService1TestCaseOperation3 for usage and error information. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation3(input *InputService1TestShapeInputService1TestCaseOperation3Input) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) { - req, out := c.InputService1TestCaseOperation3Request(input) - return out, req.Send() -} - -// InputService1TestCaseOperation3WithContext is the same as InputService1TestCaseOperation3 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService1TestCaseOperation3 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation3WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation3Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation3Output, error) { - req, out := c.InputService1TestCaseOperation3Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation3Input struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Baz *bool `type:"boolean"` - - Foo *string `type:"string"` -} - -// SetBar sets the Bar field's value. -func (s *InputService1TestShapeInputService1TestCaseOperation3Input) SetBar(v string) *InputService1TestShapeInputService1TestCaseOperation3Input { - s.Bar = &v - return s -} - -// SetBaz sets the Baz field's value. -func (s *InputService1TestShapeInputService1TestCaseOperation3Input) SetBaz(v bool) *InputService1TestShapeInputService1TestCaseOperation3Input { - s.Baz = &v - return s -} - -// SetFoo sets the Foo field's value. -func (s *InputService1TestShapeInputService1TestCaseOperation3Input) SetFoo(v string) *InputService1TestShapeInputService1TestCaseOperation3Input { - s.Foo = &v - return s -} - -type InputService1TestShapeInputService1TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -// InputService2ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService2ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService2TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService2TestCaseOperation1 for more information on using the InputService2TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService2TestCaseOperation1Request method. -// req, resp := client.InputService2TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService2TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService2TestCaseOperation1 for usage and error information. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService2TestCaseOperation1WithContext is the same as InputService2TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService2TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1WithContext(ctx aws.Context, input *InputService2TestShapeInputService2TestCaseOperation1Input, opts ...request.Option) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - StructArg *InputService2TestShapeStructType `type:"structure"` -} - -// SetStructArg sets the StructArg field's value. -func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetStructArg(v *InputService2TestShapeStructType) *InputService2TestShapeInputService2TestCaseOperation1Input { - s.StructArg = v - return s -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService2TestShapeStructType struct { - _ struct{} `type:"structure"` - - ScalarArg *string `type:"string"` -} - -// SetScalarArg sets the ScalarArg field's value. -func (s *InputService2TestShapeStructType) SetScalarArg(v string) *InputService2TestShapeStructType { - s.ScalarArg = &v - return s -} - -// InputService3ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService3ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService3TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService3TestCaseOperation1 for more information on using the InputService3TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService3TestCaseOperation1Request method. -// req, resp := client.InputService3TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation2Input{} - } - - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService3TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService3TestCaseOperation1 for usage and error information. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService3TestCaseOperation1WithContext is the same as InputService3TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService3TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService3TestCaseOperation2 = "OperationName" - -// InputService3TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService3TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService3TestCaseOperation2 for more information on using the InputService3TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService3TestCaseOperation2Request method. -// req, resp := client.InputService3TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputService3TestCaseOperation2Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation2Input{} - } - - output = &InputService3TestShapeInputService3TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService3TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService3TestCaseOperation2 for usage and error information. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputService3TestCaseOperation2Input) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { - req, out := c.InputService3TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService3TestCaseOperation2WithContext is the same as InputService3TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService3TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation2Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation2Output, error) { - req, out := c.InputService3TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeInputService3TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `type:"list"` -} - -// SetListArg sets the ListArg field's value. -func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetListArg(v []*string) *InputService3TestShapeInputService3TestCaseOperation2Input { - s.ListArg = v - return s -} - -type InputService3TestShapeInputService3TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService4ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService4ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService4TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService4TestCaseOperation1 for more information on using the InputService4TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService4TestCaseOperation1Request method. -// req, resp := client.InputService4TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation2Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation2Input{} - } - - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService4TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService4TestCaseOperation1 for usage and error information. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation2Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService4TestCaseOperation1WithContext is the same as InputService4TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService4TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1WithContext(ctx aws.Context, input *InputService4TestShapeInputService4TestCaseOperation2Input, opts ...request.Option) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService4TestCaseOperation2 = "OperationName" - -// InputService4TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService4TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService4TestCaseOperation2 for more information on using the InputService4TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService4TestCaseOperation2Request method. -// req, resp := client.InputService4TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService4ProtocolTest) InputService4TestCaseOperation2Request(input *InputService4TestShapeInputService4TestCaseOperation2Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation2Input{} - } - - output = &InputService4TestShapeInputService4TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService4TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService4TestCaseOperation2 for usage and error information. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation2(input *InputService4TestShapeInputService4TestCaseOperation2Input) (*InputService4TestShapeInputService4TestCaseOperation2Output, error) { - req, out := c.InputService4TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService4TestCaseOperation2WithContext is the same as InputService4TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService4TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation2WithContext(ctx aws.Context, input *InputService4TestShapeInputService4TestCaseOperation2Input, opts ...request.Option) (*InputService4TestShapeInputService4TestCaseOperation2Output, error) { - req, out := c.InputService4TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService4TestShapeInputService4TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `type:"list" flattened:"true"` - - NamedListArg []*string `locationNameList:"Foo" type:"list" flattened:"true"` - - ScalarArg *string `type:"string"` -} - -// SetListArg sets the ListArg field's value. -func (s *InputService4TestShapeInputService4TestCaseOperation2Input) SetListArg(v []*string) *InputService4TestShapeInputService4TestCaseOperation2Input { - s.ListArg = v - return s -} - -// SetNamedListArg sets the NamedListArg field's value. -func (s *InputService4TestShapeInputService4TestCaseOperation2Input) SetNamedListArg(v []*string) *InputService4TestShapeInputService4TestCaseOperation2Input { - s.NamedListArg = v - return s -} - -// SetScalarArg sets the ScalarArg field's value. -func (s *InputService4TestShapeInputService4TestCaseOperation2Input) SetScalarArg(v string) *InputService4TestShapeInputService4TestCaseOperation2Input { - s.ScalarArg = &v - return s -} - -type InputService4TestShapeInputService4TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService5ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService5ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation1 for more information on using the InputService5TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation1Request method. -// req, resp := client.InputService5TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation1Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation1 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation1WithContext is the same as InputService5TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation1Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService5TestShapeInputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - MapArg map[string]*string `type:"map" flattened:"true"` -} - -// SetMapArg sets the MapArg field's value. -func (s *InputService5TestShapeInputService5TestCaseOperation1Input) SetMapArg(v map[string]*string) *InputService5TestShapeInputService5TestCaseOperation1Input { - s.MapArg = v - return s -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService6ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService6ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService6TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService6TestCaseOperation1 for more information on using the InputService6TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService6TestCaseOperation1Request method. -// req, resp := client.InputService6TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService6TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService6TestCaseOperation1 for usage and error information. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService6TestCaseOperation1WithContext is the same as InputService6TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService6TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1WithContext(ctx aws.Context, input *InputService6TestShapeInputService6TestCaseOperation1Input, opts ...request.Option) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `locationNameList:"item" type:"list"` -} - -// SetListArg sets the ListArg field's value. -func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetListArg(v []*string) *InputService6TestShapeInputService6TestCaseOperation1Input { - s.ListArg = v - return s -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService7ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService7ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService7ProtocolTest client from just a session. -// svc := inputservice7protocoltest.New(mySession) -// -// // Create a InputService7ProtocolTest client with additional configuration -// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { - c := p.ClientConfig("inputservice7protocoltest", cfgs...) - return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService7ProtocolTest { - svc := &InputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice7protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService7TestCaseOperation1 = "OperationName" - -// InputService7TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService7TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService7TestCaseOperation1 for more information on using the InputService7TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService7TestCaseOperation1Request method. -// req, resp := client.InputService7TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation1Input{} - } - - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService7TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService7TestCaseOperation1 for usage and error information. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService7TestCaseOperation1WithContext is the same as InputService7TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService7TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1WithContext(ctx aws.Context, input *InputService7TestShapeInputService7TestCaseOperation1Input, opts ...request.Option) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService7TestShapeInputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - ListArg []*string `locationNameList:"ListArgLocation" type:"list" flattened:"true"` - - ScalarArg *string `type:"string"` -} - -// SetListArg sets the ListArg field's value. -func (s *InputService7TestShapeInputService7TestCaseOperation1Input) SetListArg(v []*string) *InputService7TestShapeInputService7TestCaseOperation1Input { - s.ListArg = v - return s -} - -// SetScalarArg sets the ScalarArg field's value. -func (s *InputService7TestShapeInputService7TestCaseOperation1Input) SetScalarArg(v string) *InputService7TestShapeInputService7TestCaseOperation1Input { - s.ScalarArg = &v - return s -} - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService8ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService8ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService8ProtocolTest client from just a session. -// svc := inputservice8protocoltest.New(mySession) -// -// // Create a InputService8ProtocolTest client with additional configuration -// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { - c := p.ClientConfig("inputservice8protocoltest", cfgs...) - return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService8ProtocolTest { - svc := &InputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice8protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService8TestCaseOperation1 = "OperationName" - -// InputService8TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService8TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService8TestCaseOperation1 for more information on using the InputService8TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService8TestCaseOperation1Request method. -// req, resp := client.InputService8TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService8TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService8TestShapeInputService8TestCaseOperation1Input{} - } - - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService8TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService8TestCaseOperation1 for usage and error information. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService8TestCaseOperation1WithContext is the same as InputService8TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService8TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1WithContext(ctx aws.Context, input *InputService8TestShapeInputService8TestCaseOperation1Input, opts ...request.Option) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService8TestShapeInputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - MapArg map[string]*string `type:"map"` -} - -// SetMapArg sets the MapArg field's value. -func (s *InputService8TestShapeInputService8TestCaseOperation1Input) SetMapArg(v map[string]*string) *InputService8TestShapeInputService8TestCaseOperation1Input { - s.MapArg = v - return s -} - -type InputService8TestShapeInputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService9ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService9ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService9ProtocolTest client from just a session. -// svc := inputservice9protocoltest.New(mySession) -// -// // Create a InputService9ProtocolTest client with additional configuration -// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest { - c := p.ClientConfig("inputservice9protocoltest", cfgs...) - return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService9ProtocolTest { - svc := &InputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice9protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService9TestCaseOperation1 = "OperationName" - -// InputService9TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService9TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService9TestCaseOperation1 for more information on using the InputService9TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService9TestCaseOperation1Request method. -// req, resp := client.InputService9TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService9TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService9TestShapeInputService9TestCaseOperation1Input{} - } - - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService9TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService9TestCaseOperation1 for usage and error information. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { - req, out := c.InputService9TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService9TestCaseOperation1WithContext is the same as InputService9TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService9TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1WithContext(ctx aws.Context, input *InputService9TestShapeInputService9TestCaseOperation1Input, opts ...request.Option) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { - req, out := c.InputService9TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService9TestShapeInputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - MapArg map[string]*string `locationNameKey:"TheKey" locationNameValue:"TheValue" type:"map"` -} - -// SetMapArg sets the MapArg field's value. -func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetMapArg(v map[string]*string) *InputService9TestShapeInputService9TestCaseOperation1Input { - s.MapArg = v - return s -} - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService10ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService10ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService10ProtocolTest client from just a session. -// svc := inputservice10protocoltest.New(mySession) -// -// // Create a InputService10ProtocolTest client with additional configuration -// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest { - c := p.ClientConfig("inputservice10protocoltest", cfgs...) - return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService10ProtocolTest { - svc := &InputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice10protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService10TestCaseOperation1 = "OperationName" - -// InputService10TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService10TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService10TestCaseOperation1 for more information on using the InputService10TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService10TestCaseOperation1Request method. -// req, resp := client.InputService10TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation1Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService10TestShapeInputService10TestCaseOperation1Input{} - } - - output = &InputService10TestShapeInputService10TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService10TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService10TestCaseOperation1 for usage and error information. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation1Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { - req, out := c.InputService10TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService10TestCaseOperation1WithContext is the same as InputService10TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService10TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1WithContext(ctx aws.Context, input *InputService10TestShapeInputService10TestCaseOperation1Input, opts ...request.Option) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { - req, out := c.InputService10TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService10TestShapeInputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - // BlobArg is automatically base64 encoded/decoded by the SDK. - BlobArg []byte `type:"blob"` -} - -// SetBlobArg sets the BlobArg field's value. -func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetBlobArg(v []byte) *InputService10TestShapeInputService10TestCaseOperation1Input { - s.BlobArg = v - return s -} - -type InputService10TestShapeInputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService11ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService11ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService11ProtocolTest client from just a session. -// svc := inputservice11protocoltest.New(mySession) -// -// // Create a InputService11ProtocolTest client with additional configuration -// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest { - c := p.ClientConfig("inputservice11protocoltest", cfgs...) - return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService11ProtocolTest { - svc := &InputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice11protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService11TestCaseOperation1 = "OperationName" - -// InputService11TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService11TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService11TestCaseOperation1 for more information on using the InputService11TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService11TestCaseOperation1Request method. -// req, resp := client.InputService11TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputService11TestCaseOperation1Input) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService11TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService11TestShapeInputService11TestCaseOperation1Input{} - } - - output = &InputService11TestShapeInputService11TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService11TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService11TestCaseOperation1 for usage and error information. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputService11TestCaseOperation1Input) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { - req, out := c.InputService11TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService11TestCaseOperation1WithContext is the same as InputService11TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService11TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1WithContext(ctx aws.Context, input *InputService11TestShapeInputService11TestCaseOperation1Input, opts ...request.Option) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { - req, out := c.InputService11TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService11TestShapeInputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - BlobArgs [][]byte `type:"list" flattened:"true"` -} - -// SetBlobArgs sets the BlobArgs field's value. -func (s *InputService11TestShapeInputService11TestCaseOperation1Input) SetBlobArgs(v [][]byte) *InputService11TestShapeInputService11TestCaseOperation1Input { - s.BlobArgs = v - return s -} - -type InputService11TestShapeInputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService12ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService12ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService12ProtocolTest client from just a session. -// svc := inputservice12protocoltest.New(mySession) -// -// // Create a InputService12ProtocolTest client with additional configuration -// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest { - c := p.ClientConfig("inputservice12protocoltest", cfgs...) - return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService12ProtocolTest { - svc := &InputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice12protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService12TestCaseOperation1 = "OperationName" - -// InputService12TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService12TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService12TestCaseOperation1 for more information on using the InputService12TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService12TestCaseOperation1Request method. -// req, resp := client.InputService12TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputService12TestCaseOperation1Input) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService12TestShapeInputService12TestCaseOperation1Input{} - } - - output = &InputService12TestShapeInputService12TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService12TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService12TestCaseOperation1 for usage and error information. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputService12TestCaseOperation1Input) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { - req, out := c.InputService12TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService12TestCaseOperation1WithContext is the same as InputService12TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService12TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1WithContext(ctx aws.Context, input *InputService12TestShapeInputService12TestCaseOperation1Input, opts ...request.Option) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { - req, out := c.InputService12TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService12TestShapeInputService12TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` -} - -// SetTimeArg sets the TimeArg field's value. -func (s *InputService12TestShapeInputService12TestCaseOperation1Input) SetTimeArg(v time.Time) *InputService12TestShapeInputService12TestCaseOperation1Input { - s.TimeArg = &v - return s -} - -type InputService12TestShapeInputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService13ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService13ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService13ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService13ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService13ProtocolTest client from just a session. -// svc := inputservice13protocoltest.New(mySession) -// -// // Create a InputService13ProtocolTest client with additional configuration -// svc := inputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService13ProtocolTest { - c := p.ClientConfig("inputservice13protocoltest", cfgs...) - return newInputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService13ProtocolTest { - svc := &InputService13ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice13protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService13TestCaseOperation1 = "OperationName" - -// InputService13TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation1 for more information on using the InputService13TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation1Request method. -// req, resp := client.InputService13TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation6Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation1 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) { - req, out := c.InputService13TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation1WithContext is the same as InputService13TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) { - req, out := c.InputService13TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService13TestCaseOperation2 = "OperationName" - -// InputService13TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation2 for more information on using the InputService13TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation2Request method. -// req, resp := client.InputService13TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation6Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation2 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation2Output, error) { - req, out := c.InputService13TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation2WithContext is the same as InputService13TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation2Output, error) { - req, out := c.InputService13TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService13TestCaseOperation3 = "OperationName" - -// InputService13TestCaseOperation3Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation3 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation3 for more information on using the InputService13TestCaseOperation3 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation3Request method. -// req, resp := client.InputService13TestCaseOperation3Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation3Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation3, - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation6Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation3 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation3 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation3(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation3Output, error) { - req, out := c.InputService13TestCaseOperation3Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation3WithContext is the same as InputService13TestCaseOperation3 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation3 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation3WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation3Output, error) { - req, out := c.InputService13TestCaseOperation3Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService13TestCaseOperation4 = "OperationName" - -// InputService13TestCaseOperation4Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation4 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation4 for more information on using the InputService13TestCaseOperation4 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation4Request method. -// req, resp := client.InputService13TestCaseOperation4Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation4Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation4, - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation6Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation4Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation4 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation4 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation4(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation4Output, error) { - req, out := c.InputService13TestCaseOperation4Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation4WithContext is the same as InputService13TestCaseOperation4 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation4 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation4WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation4Output, error) { - req, out := c.InputService13TestCaseOperation4Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService13TestCaseOperation5 = "OperationName" - -// InputService13TestCaseOperation5Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation5 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation5 for more information on using the InputService13TestCaseOperation5 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation5Request method. -// req, resp := client.InputService13TestCaseOperation5Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation5Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation5, - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation6Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation5Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation5 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation5 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation5(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation5Output, error) { - req, out := c.InputService13TestCaseOperation5Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation5WithContext is the same as InputService13TestCaseOperation5 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation5 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation5WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation5Output, error) { - req, out := c.InputService13TestCaseOperation5Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService13TestCaseOperation6 = "OperationName" - -// InputService13TestCaseOperation6Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation6 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation6 for more information on using the InputService13TestCaseOperation6 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation6Request method. -// req, resp := client.InputService13TestCaseOperation6Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation6Request(input *InputService13TestShapeInputService13TestCaseOperation6Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation6, - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation6Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation6Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation6 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation6 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation6(input *InputService13TestShapeInputService13TestCaseOperation6Input) (*InputService13TestShapeInputService13TestCaseOperation6Output, error) { - req, out := c.InputService13TestCaseOperation6Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation6WithContext is the same as InputService13TestCaseOperation6 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation6 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation6WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation6Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation6Output, error) { - req, out := c.InputService13TestCaseOperation6Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService13TestShapeInputService13TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation6Input struct { - _ struct{} `type:"structure"` - - RecursiveStruct *InputService13TestShapeRecursiveStructType `type:"structure"` -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService13TestShapeInputService13TestCaseOperation6Input) SetRecursiveStruct(v *InputService13TestShapeRecursiveStructType) *InputService13TestShapeInputService13TestCaseOperation6Input { - s.RecursiveStruct = v - return s -} - -type InputService13TestShapeInputService13TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService13TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService13TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService13TestShapeRecursiveStructType `type:"structure"` -} - -// SetNoRecurse sets the NoRecurse field's value. -func (s *InputService13TestShapeRecursiveStructType) SetNoRecurse(v string) *InputService13TestShapeRecursiveStructType { - s.NoRecurse = &v - return s -} - -// SetRecursiveList sets the RecursiveList field's value. -func (s *InputService13TestShapeRecursiveStructType) SetRecursiveList(v []*InputService13TestShapeRecursiveStructType) *InputService13TestShapeRecursiveStructType { - s.RecursiveList = v - return s -} - -// SetRecursiveMap sets the RecursiveMap field's value. -func (s *InputService13TestShapeRecursiveStructType) SetRecursiveMap(v map[string]*InputService13TestShapeRecursiveStructType) *InputService13TestShapeRecursiveStructType { - s.RecursiveMap = v - return s -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService13TestShapeRecursiveStructType) SetRecursiveStruct(v *InputService13TestShapeRecursiveStructType) *InputService13TestShapeRecursiveStructType { - s.RecursiveStruct = v - return s -} - -// InputService14ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService14ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService14ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService14ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService14ProtocolTest client from just a session. -// svc := inputservice14protocoltest.New(mySession) -// -// // Create a InputService14ProtocolTest client with additional configuration -// svc := inputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService14ProtocolTest { - c := p.ClientConfig("inputservice14protocoltest", cfgs...) - return newInputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService14ProtocolTest { - svc := &InputService14ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice14protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService14TestCaseOperation1 = "OperationName" - -// InputService14TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService14TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService14TestCaseOperation1 for more information on using the InputService14TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService14TestCaseOperation1Request method. -// req, resp := client.InputService14TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputService14TestCaseOperation2Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService14TestShapeInputService14TestCaseOperation2Input{} - } - - output = &InputService14TestShapeInputService14TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService14TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService14TestCaseOperation1 for usage and error information. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *InputService14TestShapeInputService14TestCaseOperation2Input) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) { - req, out := c.InputService14TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService14TestCaseOperation1WithContext is the same as InputService14TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService14TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1WithContext(ctx aws.Context, input *InputService14TestShapeInputService14TestCaseOperation2Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) { - req, out := c.InputService14TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService14TestCaseOperation2 = "OperationName" - -// InputService14TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService14TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService14TestCaseOperation2 for more information on using the InputService14TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService14TestCaseOperation2Request method. -// req, resp := client.InputService14TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2Request(input *InputService14TestShapeInputService14TestCaseOperation2Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService14TestShapeInputService14TestCaseOperation2Input{} - } - - output = &InputService14TestShapeInputService14TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService14TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService14TestCaseOperation2 for usage and error information. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2(input *InputService14TestShapeInputService14TestCaseOperation2Input) (*InputService14TestShapeInputService14TestCaseOperation2Output, error) { - req, out := c.InputService14TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService14TestCaseOperation2WithContext is the same as InputService14TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService14TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2WithContext(ctx aws.Context, input *InputService14TestShapeInputService14TestCaseOperation2Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation2Output, error) { - req, out := c.InputService14TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService14TestShapeInputService14TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService14TestShapeInputService14TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - Token *string `type:"string" idempotencyToken:"true"` -} - -// SetToken sets the Token field's value. -func (s *InputService14TestShapeInputService14TestCaseOperation2Input) SetToken(v string) *InputService14TestShapeInputService14TestCaseOperation2Input { - s.Token = &v - return s -} - -type InputService14TestShapeInputService14TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation3Input{ - Bar: aws.String("val2"), - Foo: aws.String("val1"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestScalarMembersCase2(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation3Input{ - Baz: aws.Bool(true), - } - req, _ := svc.InputService1TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Baz=true&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestScalarMembersCase3(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation3Input{ - Baz: aws.Bool(false), - } - req, _ := svc.InputService1TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Baz=false&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - StructArg: &InputService2TestShapeStructType{ - ScalarArg: aws.String("foo"), - }, - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&StructArg.ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation2Input{ - ListArg: []*string{ - aws.String("foo"), - aws.String("bar"), - aws.String("baz"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestListTypesCase2(t *testing.T) { - svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation2Input{ - ListArg: []*string{}, - } - req, _ := svc.InputService3TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg=&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService4TestShapeInputService4TestCaseOperation2Input{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - ScalarArg: aws.String("foo"), - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) { - svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService4TestShapeInputService4TestCaseOperation2Input{ - NamedListArg: []*string{ - aws.String("a"), - }, - } - req, _ := svc.InputService4TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Foo.1=a&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestSerializeFlattenedMapTypeCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation1Input{ - MapArg: map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&MapArg.1.key=key1&MapArg.1.value=val1&MapArg.2.key=key2&MapArg.2.value=val2&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestNonFlattenedListWithLocationNameCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArg.item.1=a&ListArg.item.2=b&ListArg.item.3=c&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService7TestShapeInputService7TestCaseOperation1Input{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - ScalarArg: aws.String("foo"), - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&ListArgLocation.1=a&ListArgLocation.2=b&ListArgLocation.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService8ProtocolTestSerializeMapTypeCase1(t *testing.T) { - svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ - MapArg: map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.key=key1&MapArg.entry.1.value=val1&MapArg.entry.2.key=key2&MapArg.entry.2.value=val2&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { - svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService9TestShapeInputService9TestCaseOperation1Input{ - MapArg: map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputService10TestCaseOperation1Input{ - BlobArg: []byte("foo"), - } - req, _ := svc.InputService10TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService11ProtocolTestBase64EncodedBlobsNestedCase1(t *testing.T) { - svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService11TestShapeInputService11TestCaseOperation1Input{ - BlobArgs: [][]byte{ - []byte("foo"), - }, - } - req, _ := svc.InputService11TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&BlobArgs.1=Zm9v&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService12ProtocolTestTimestampValuesCase1(t *testing.T) { - svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService12TestShapeInputService12TestCaseOperation1Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService12TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase1(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation6Input{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService13TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase2(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation6Input{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService13TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase3(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation6Input{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase4(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation6Input{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveList: []*InputService13TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase5(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation6Input{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveList: []*InputService13TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.RecursiveStruct.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestRecursiveShapesCase6(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation6Input{ - RecursiveStruct: &InputService13TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService13TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService13TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveMap.entry.1.key=foo&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=foo&RecursiveStruct.RecursiveMap.entry.2.key=bar&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService14TestShapeInputService14TestCaseOperation2Input{ - Token: aws.String("abc123"), - } - req, _ := svc.InputService14TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Token=abc123&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService14TestShapeInputService14TestCaseOperation2Input{} - req, _ := svc.InputService14TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertQuery(t, `Action=OperationName&Token=00000000-0000-4000-8000-000000000000&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go deleted file mode 100644 index 5ce9cba3..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go +++ /dev/null @@ -1,241 +0,0 @@ -package queryutil - -import ( - "encoding/base64" - "fmt" - "net/url" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/private/protocol" -) - -// Parse parses an object i and fills a url.Values object. The isEC2 flag -// indicates if this is the EC2 Query sub-protocol. -func Parse(body url.Values, i interface{}, isEC2 bool) error { - q := queryParser{isEC2: isEC2} - return q.parseValue(body, reflect.ValueOf(i), "", "") -} - -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} - -type queryParser struct { - isEC2 bool -} - -func (q *queryParser) parseValue(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - value = elemOf(value) - - // no need to handle zero values - if !value.IsValid() { - return nil - } - - t := tag.Get("type") - if t == "" { - switch value.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - return q.parseStruct(v, value, prefix) - case "list": - return q.parseList(v, value, prefix, tag) - case "map": - return q.parseMap(v, value, prefix, tag) - default: - return q.parseScalar(v, value, prefix, tag) - } -} - -func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix string) error { - if !value.IsValid() { - return nil - } - - t := value.Type() - for i := 0; i < value.NumField(); i++ { - elemValue := elemOf(value.Field(i)) - field := t.Field(i) - - if field.PkgPath != "" { - continue // ignore unexported fields - } - if field.Tag.Get("ignore") != "" { - continue - } - - if protocol.CanSetIdempotencyToken(value.Field(i), field) { - token := protocol.GetIdempotencyToken() - elemValue = reflect.ValueOf(token) - } - - var name string - if q.isEC2 { - name = field.Tag.Get("queryName") - } - if name == "" { - if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { - name = field.Tag.Get("locationNameList") - } else if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - if name != "" && q.isEC2 { - name = strings.ToUpper(name[0:1]) + name[1:] - } - } - if name == "" { - name = field.Name - } - - if prefix != "" { - name = prefix + "." + name - } - - if err := q.parseValue(v, elemValue, name, field.Tag); err != nil { - return err - } - } - return nil -} - -func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - // If it's empty, generate an empty value - if !value.IsNil() && value.Len() == 0 { - v.Set(prefix, "") - return nil - } - - if _, ok := value.Interface().([]byte); ok { - return q.parseScalar(v, value, prefix, tag) - } - - // check for unflattened list member - if !q.isEC2 && tag.Get("flattened") == "" { - if listName := tag.Get("locationNameList"); listName == "" { - prefix += ".member" - } else { - prefix += "." + listName - } - } - - for i := 0; i < value.Len(); i++ { - slicePrefix := prefix - if slicePrefix == "" { - slicePrefix = strconv.Itoa(i + 1) - } else { - slicePrefix = slicePrefix + "." + strconv.Itoa(i+1) - } - if err := q.parseValue(v, value.Index(i), slicePrefix, ""); err != nil { - return err - } - } - return nil -} - -func (q *queryParser) parseMap(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - // If it's empty, generate an empty value - if !value.IsNil() && value.Len() == 0 { - v.Set(prefix, "") - return nil - } - - // check for unflattened list member - if !q.isEC2 && tag.Get("flattened") == "" { - prefix += ".entry" - } - - // sort keys for improved serialization consistency. - // this is not strictly necessary for protocol support. - mapKeyValues := value.MapKeys() - mapKeys := map[string]reflect.Value{} - mapKeyNames := make([]string, len(mapKeyValues)) - for i, mapKey := range mapKeyValues { - name := mapKey.String() - mapKeys[name] = mapKey - mapKeyNames[i] = name - } - sort.Strings(mapKeyNames) - - for i, mapKeyName := range mapKeyNames { - mapKey := mapKeys[mapKeyName] - mapValue := value.MapIndex(mapKey) - - kname := tag.Get("locationNameKey") - if kname == "" { - kname = "key" - } - vname := tag.Get("locationNameValue") - if vname == "" { - vname = "value" - } - - // serialize key - var keyName string - if prefix == "" { - keyName = strconv.Itoa(i+1) + "." + kname - } else { - keyName = prefix + "." + strconv.Itoa(i+1) + "." + kname - } - - if err := q.parseValue(v, mapKey, keyName, ""); err != nil { - return err - } - - // serialize value - var valueName string - if prefix == "" { - valueName = strconv.Itoa(i+1) + "." + vname - } else { - valueName = prefix + "." + strconv.Itoa(i+1) + "." + vname - } - - if err := q.parseValue(v, mapValue, valueName, ""); err != nil { - return err - } - } - - return nil -} - -func (q *queryParser) parseScalar(v url.Values, r reflect.Value, name string, tag reflect.StructTag) error { - switch value := r.Interface().(type) { - case string: - v.Set(name, value) - case []byte: - if !r.IsNil() { - v.Set(name, base64.StdEncoding.EncodeToString(value)) - } - case bool: - v.Set(name, strconv.FormatBool(value)) - case int64: - v.Set(name, strconv.FormatInt(value, 10)) - case int: - v.Set(name, strconv.Itoa(value)) - case float64: - v.Set(name, strconv.FormatFloat(value, 'f', -1, 64)) - case float32: - v.Set(name, strconv.FormatFloat(float64(value), 'f', -1, 32)) - case time.Time: - const ISO8601UTC = "2006-01-02T15:04:05Z" - v.Set(name, value.UTC().Format(ISO8601UTC)) - default: - return fmt.Errorf("unsupported value for param %s: %v (%s)", name, r.Interface(), r.Type().Name()) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go deleted file mode 100644 index e0f4d5a5..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go +++ /dev/null @@ -1,35 +0,0 @@ -package query - -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go - -import ( - "encoding/xml" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" -) - -// UnmarshalHandler is a named request handler for unmarshaling query protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} - -// Unmarshal unmarshals a response for an AWS Query service. -func Unmarshal(r *request.Request) { - defer r.HTTPResponse.Body.Close() - if r.DataFilled() { - decoder := xml.NewDecoder(r.HTTPResponse.Body) - err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") - if err != nil { - r.Error = awserr.New("SerializationError", "failed decoding Query response", err) - return - } - } -} - -// UnmarshalMeta unmarshals header response values for an AWS Query service. -func UnmarshalMeta(r *request.Request) { - r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go deleted file mode 100644 index f2142961..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go +++ /dev/null @@ -1,66 +0,0 @@ -package query - -import ( - "encoding/xml" - "io/ioutil" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -type xmlErrorResponse struct { - XMLName xml.Name `xml:"ErrorResponse"` - Code string `xml:"Error>Code"` - Message string `xml:"Error>Message"` - RequestID string `xml:"RequestId"` -} - -type xmlServiceUnavailableResponse struct { - XMLName xml.Name `xml:"ServiceUnavailableException"` -} - -// UnmarshalErrorHandler is a name request handler to unmarshal request errors -var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} - -// UnmarshalError unmarshals an error response for an AWS Query service. -func UnmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - - bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", "failed to read from query HTTP response body", err) - return - } - - // First check for specific error - resp := xmlErrorResponse{} - decodeErr := xml.Unmarshal(bodyBytes, &resp) - if decodeErr == nil { - reqID := resp.RequestID - if reqID == "" { - reqID = r.RequestID - } - r.Error = awserr.NewRequestFailure( - awserr.New(resp.Code, resp.Message, nil), - r.HTTPResponse.StatusCode, - reqID, - ) - return - } - - // Check for unhandled error - servUnavailResp := xmlServiceUnavailableResponse{} - unavailErr := xml.Unmarshal(bodyBytes, &servUnavailResp) - if unavailErr == nil { - r.Error = awserr.NewRequestFailure( - awserr.New("ServiceUnavailableException", "service is unavailable", nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - - // Failed to retrieve any error message from the response body - r.Error = awserr.New("SerializationError", - "failed to decode query XML error response", decodeErr) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go deleted file mode 100644 index c13bc06e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go +++ /dev/null @@ -1,2800 +0,0 @@ -package query_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/query" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/util" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String -var _ = fmt.Println -var _ = reflect.Value{} - -func init() { - protocol.RandReader = &awstesting.ZeroReader{} -} - -// OutputService1ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService1ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService1TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService1TestCaseOperation1 for more information on using the OutputService1TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService1TestCaseOperation1Request method. -// req, resp := client.OutputService1TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService1TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService1TestCaseOperation1 for usage and error information. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService1TestCaseOperation1WithContext is the same as OutputService1TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService1TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation1Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - Long *int64 `type:"long"` - - Num *int64 `locationName:"FooNum" type:"integer"` - - Str *string `type:"string"` - - Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `type:"boolean"` -} - -// SetChar sets the Char field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetChar(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Char = &v - return s -} - -// SetDouble sets the Double field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetDouble(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Double = &v - return s -} - -// SetFalseBool sets the FalseBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFalseBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.FalseBool = &v - return s -} - -// SetFloat sets the Float field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFloat(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Float = &v - return s -} - -// SetLong sets the Long field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetLong(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Long = &v - return s -} - -// SetNum sets the Num field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetNum(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Num = &v - return s -} - -// SetStr sets the Str field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetStr(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Str = &v - return s -} - -// SetTimestamp sets the Timestamp field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetTimestamp(v time.Time) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Timestamp = &v - return s -} - -// SetTrueBool sets the TrueBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetTrueBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.TrueBool = &v - return s -} - -// OutputService2ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService2ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService2TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService2TestCaseOperation1 for more information on using the OutputService2TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService2TestCaseOperation1Request method. -// req, resp := client.OutputService2TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService2TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService2TestCaseOperation1 for usage and error information. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService2TestCaseOperation1WithContext is the same as OutputService2TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService2TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1WithContext(ctx aws.Context, input *OutputService2TestShapeOutputService2TestCaseOperation1Input, opts ...request.Option) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Num *int64 `type:"integer"` - - Str *string `type:"string"` -} - -// SetNum sets the Num field's value. -func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetNum(v int64) *OutputService2TestShapeOutputService2TestCaseOperation1Output { - s.Num = &v - return s -} - -// SetStr sets the Str field's value. -func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetStr(v string) *OutputService2TestShapeOutputService2TestCaseOperation1Output { - s.Str = &v - return s -} - -// OutputService3ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService3ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService3TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService3TestCaseOperation1 for more information on using the OutputService3TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService3TestCaseOperation1Request method. -// req, resp := client.OutputService3TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService3TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService3TestCaseOperation1 for usage and error information. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService3TestCaseOperation1WithContext is the same as OutputService3TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService3TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1WithContext(ctx aws.Context, input *OutputService3TestShapeOutputService3TestCaseOperation1Input, opts ...request.Option) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - // Blob is automatically base64 encoded/decoded by the SDK. - Blob []byte `type:"blob"` -} - -// SetBlob sets the Blob field's value. -func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetBlob(v []byte) *OutputService3TestShapeOutputService3TestCaseOperation1Output { - s.Blob = v - return s -} - -// OutputService4ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService4ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService4TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService4TestCaseOperation1 for more information on using the OutputService4TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService4TestCaseOperation1Request method. -// req, resp := client.OutputService4TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService4TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService4TestCaseOperation1 for usage and error information. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService4TestCaseOperation1WithContext is the same as OutputService4TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService4TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1WithContext(ctx aws.Context, input *OutputService4TestShapeOutputService4TestCaseOperation1Input, opts ...request.Option) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService4TestShapeOutputService4TestCaseOperation1Output) SetListMember(v []*string) *OutputService4TestShapeOutputService4TestCaseOperation1Output { - s.ListMember = v - return s -} - -// OutputService5ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService5ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService5TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService5TestCaseOperation1 for more information on using the OutputService5TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService5TestCaseOperation1Request method. -// req, resp := client.OutputService5TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService5TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService5TestCaseOperation1 for usage and error information. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService5TestCaseOperation1WithContext is the same as OutputService5TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService5TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1WithContext(ctx aws.Context, input *OutputService5TestShapeOutputService5TestCaseOperation1Input, opts ...request.Option) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `locationNameList:"item" type:"list"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService5TestShapeOutputService5TestCaseOperation1Output) SetListMember(v []*string) *OutputService5TestShapeOutputService5TestCaseOperation1Output { - s.ListMember = v - return s -} - -// OutputService6ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService6ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService6TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService6TestCaseOperation1 for more information on using the OutputService6TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService6TestCaseOperation1Request method. -// req, resp := client.OutputService6TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService6TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService6TestCaseOperation1 for usage and error information. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService6TestCaseOperation1WithContext is the same as OutputService6TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService6TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1WithContext(ctx aws.Context, input *OutputService6TestShapeOutputService6TestCaseOperation1Input, opts ...request.Option) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list" flattened:"true"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService6TestShapeOutputService6TestCaseOperation1Output) SetListMember(v []*string) *OutputService6TestShapeOutputService6TestCaseOperation1Output { - s.ListMember = v - return s -} - -// OutputService7ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService7ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService7ProtocolTest client from just a session. -// svc := outputservice7protocoltest.New(mySession) -// -// // Create a OutputService7ProtocolTest client with additional configuration -// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { - c := p.ClientConfig("outputservice7protocoltest", cfgs...) - return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService7ProtocolTest { - svc := &OutputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice7protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService7TestCaseOperation1 = "OperationName" - -// OutputService7TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService7TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService7TestCaseOperation1 for more information on using the OutputService7TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService7TestCaseOperation1Request method. -// req, resp := client.OutputService7TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService7TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService7TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService7TestCaseOperation1 for usage and error information. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService7TestCaseOperation1WithContext is the same as OutputService7TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService7TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1WithContext(ctx aws.Context, input *OutputService7TestShapeOutputService7TestCaseOperation1Input, opts ...request.Option) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list" flattened:"true"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService7TestShapeOutputService7TestCaseOperation1Output) SetListMember(v []*string) *OutputService7TestShapeOutputService7TestCaseOperation1Output { - s.ListMember = v - return s -} - -// OutputService8ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService8ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService8ProtocolTest client from just a session. -// svc := outputservice8protocoltest.New(mySession) -// -// // Create a OutputService8ProtocolTest client with additional configuration -// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { - c := p.ClientConfig("outputservice8protocoltest", cfgs...) - return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService8ProtocolTest { - svc := &OutputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice8protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService8TestCaseOperation1 = "OperationName" - -// OutputService8TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService8TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService8TestCaseOperation1 for more information on using the OutputService8TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService8TestCaseOperation1Request method. -// req, resp := client.OutputService8TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService8TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService8TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService8TestCaseOperation1 for usage and error information. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService8TestCaseOperation1WithContext is the same as OutputService8TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService8TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1WithContext(ctx aws.Context, input *OutputService8TestShapeOutputService8TestCaseOperation1Input, opts ...request.Option) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - List []*OutputService8TestShapeStructureShape `type:"list"` -} - -// SetList sets the List field's value. -func (s *OutputService8TestShapeOutputService8TestCaseOperation1Output) SetList(v []*OutputService8TestShapeStructureShape) *OutputService8TestShapeOutputService8TestCaseOperation1Output { - s.List = v - return s -} - -type OutputService8TestShapeStructureShape struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Baz *string `type:"string"` - - Foo *string `type:"string"` -} - -// SetBar sets the Bar field's value. -func (s *OutputService8TestShapeStructureShape) SetBar(v string) *OutputService8TestShapeStructureShape { - s.Bar = &v - return s -} - -// SetBaz sets the Baz field's value. -func (s *OutputService8TestShapeStructureShape) SetBaz(v string) *OutputService8TestShapeStructureShape { - s.Baz = &v - return s -} - -// SetFoo sets the Foo field's value. -func (s *OutputService8TestShapeStructureShape) SetFoo(v string) *OutputService8TestShapeStructureShape { - s.Foo = &v - return s -} - -// OutputService9ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService9ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService9ProtocolTest client from just a session. -// svc := outputservice9protocoltest.New(mySession) -// -// // Create a OutputService9ProtocolTest client with additional configuration -// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { - c := p.ClientConfig("outputservice9protocoltest", cfgs...) - return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService9ProtocolTest { - svc := &OutputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice9protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService9TestCaseOperation1 = "OperationName" - -// OutputService9TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService9TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService9TestCaseOperation1 for more information on using the OutputService9TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService9TestCaseOperation1Request method. -// req, resp := client.OutputService9TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService9TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService9TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService9TestCaseOperation1 for usage and error information. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService9TestCaseOperation1WithContext is the same as OutputService9TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService9TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1WithContext(ctx aws.Context, input *OutputService9TestShapeOutputService9TestCaseOperation1Input, opts ...request.Option) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - List []*OutputService9TestShapeStructureShape `type:"list" flattened:"true"` -} - -// SetList sets the List field's value. -func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetList(v []*OutputService9TestShapeStructureShape) *OutputService9TestShapeOutputService9TestCaseOperation1Output { - s.List = v - return s -} - -type OutputService9TestShapeStructureShape struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Baz *string `type:"string"` - - Foo *string `type:"string"` -} - -// SetBar sets the Bar field's value. -func (s *OutputService9TestShapeStructureShape) SetBar(v string) *OutputService9TestShapeStructureShape { - s.Bar = &v - return s -} - -// SetBaz sets the Baz field's value. -func (s *OutputService9TestShapeStructureShape) SetBaz(v string) *OutputService9TestShapeStructureShape { - s.Baz = &v - return s -} - -// SetFoo sets the Foo field's value. -func (s *OutputService9TestShapeStructureShape) SetFoo(v string) *OutputService9TestShapeStructureShape { - s.Foo = &v - return s -} - -// OutputService10ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService10ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService10ProtocolTest client from just a session. -// svc := outputservice10protocoltest.New(mySession) -// -// // Create a OutputService10ProtocolTest client with additional configuration -// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest { - c := p.ClientConfig("outputservice10protocoltest", cfgs...) - return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService10ProtocolTest { - svc := &OutputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice10protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService10TestCaseOperation1 = "OperationName" - -// OutputService10TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService10TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService10TestCaseOperation1 for more information on using the OutputService10TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService10TestCaseOperation1Request method. -// req, resp := client.OutputService10TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService10TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} - } - - output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService10TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService10TestCaseOperation1 for usage and error information. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService10TestCaseOperation1WithContext is the same as OutputService10TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService10TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1WithContext(ctx aws.Context, input *OutputService10TestShapeOutputService10TestCaseOperation1Input, opts ...request.Option) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - List []*string `locationNameList:"NamedList" type:"list" flattened:"true"` -} - -// SetList sets the List field's value. -func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetList(v []*string) *OutputService10TestShapeOutputService10TestCaseOperation1Output { - s.List = v - return s -} - -// OutputService11ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService11ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService11ProtocolTest client from just a session. -// svc := outputservice11protocoltest.New(mySession) -// -// // Create a OutputService11ProtocolTest client with additional configuration -// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest { - c := p.ClientConfig("outputservice11protocoltest", cfgs...) - return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService11ProtocolTest { - svc := &OutputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice11protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService11TestCaseOperation1 = "OperationName" - -// OutputService11TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService11TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService11TestCaseOperation1 for more information on using the OutputService11TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService11TestCaseOperation1Request method. -// req, resp := client.OutputService11TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService11TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} - } - - output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService11TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService11TestCaseOperation1 for usage and error information. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService11TestCaseOperation1WithContext is the same as OutputService11TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService11TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1WithContext(ctx aws.Context, input *OutputService11TestShapeOutputService11TestCaseOperation1Input, opts ...request.Option) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*OutputService11TestShapeStructType `type:"map"` -} - -// SetMap sets the Map field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetMap(v map[string]*OutputService11TestShapeStructType) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Map = v - return s -} - -type OutputService11TestShapeStructType struct { - _ struct{} `type:"structure"` - - Foo *string `locationName:"foo" type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService11TestShapeStructType) SetFoo(v string) *OutputService11TestShapeStructType { - s.Foo = &v - return s -} - -// OutputService12ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService12ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService12ProtocolTest client from just a session. -// svc := outputservice12protocoltest.New(mySession) -// -// // Create a OutputService12ProtocolTest client with additional configuration -// svc := outputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService12ProtocolTest { - c := p.ClientConfig("outputservice12protocoltest", cfgs...) - return newOutputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService12ProtocolTest { - svc := &OutputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice12protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService12TestCaseOperation1 = "OperationName" - -// OutputService12TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService12TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService12TestCaseOperation1 for more information on using the OutputService12TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService12TestCaseOperation1Request method. -// req, resp := client.OutputService12TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService12TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{} - } - - output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService12TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService12TestCaseOperation1 for usage and error information. -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) { - req, out := c.OutputService12TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService12TestCaseOperation1WithContext is the same as OutputService12TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService12TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1WithContext(ctx aws.Context, input *OutputService12TestShapeOutputService12TestCaseOperation1Input, opts ...request.Option) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) { - req, out := c.OutputService12TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `type:"map" flattened:"true"` -} - -// SetMap sets the Map field's value. -func (s *OutputService12TestShapeOutputService12TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService12TestShapeOutputService12TestCaseOperation1Output { - s.Map = v - return s -} - -// OutputService13ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService13ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService13ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService13ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService13ProtocolTest client from just a session. -// svc := outputservice13protocoltest.New(mySession) -// -// // Create a OutputService13ProtocolTest client with additional configuration -// svc := outputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService13ProtocolTest { - c := p.ClientConfig("outputservice13protocoltest", cfgs...) - return newOutputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService13ProtocolTest { - svc := &OutputService13ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice13protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService13TestCaseOperation1 = "OperationName" - -// OutputService13TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService13TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService13TestCaseOperation1 for more information on using the OutputService13TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService13TestCaseOperation1Request method. -// req, resp := client.OutputService13TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService13TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{} - } - - output = &OutputService13TestShapeOutputService13TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService13TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService13TestCaseOperation1 for usage and error information. -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (*OutputService13TestShapeOutputService13TestCaseOperation1Output, error) { - req, out := c.OutputService13TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService13TestCaseOperation1WithContext is the same as OutputService13TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService13TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1WithContext(ctx aws.Context, input *OutputService13TestShapeOutputService13TestCaseOperation1Input, opts ...request.Option) (*OutputService13TestShapeOutputService13TestCaseOperation1Output, error) { - req, out := c.OutputService13TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService13TestShapeOutputService13TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService13TestShapeOutputService13TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `locationName:"Attribute" locationNameKey:"Name" locationNameValue:"Value" type:"map" flattened:"true"` -} - -// SetMap sets the Map field's value. -func (s *OutputService13TestShapeOutputService13TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService13TestShapeOutputService13TestCaseOperation1Output { - s.Map = v - return s -} - -// OutputService14ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService14ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService14ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService14ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService14ProtocolTest client from just a session. -// svc := outputservice14protocoltest.New(mySession) -// -// // Create a OutputService14ProtocolTest client with additional configuration -// svc := outputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService14ProtocolTest { - c := p.ClientConfig("outputservice14protocoltest", cfgs...) - return newOutputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService14ProtocolTest { - svc := &OutputService14ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice14protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService14TestCaseOperation1 = "OperationName" - -// OutputService14TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService14TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService14TestCaseOperation1 for more information on using the OutputService14TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService14TestCaseOperation1Request method. -// req, resp := client.OutputService14TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *request.Request, output *OutputService14TestShapeOutputService14TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService14TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService14TestShapeOutputService14TestCaseOperation1Input{} - } - - output = &OutputService14TestShapeOutputService14TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService14TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService14TestCaseOperation1 for usage and error information. -func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) { - req, out := c.OutputService14TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService14TestCaseOperation1WithContext is the same as OutputService14TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService14TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1WithContext(ctx aws.Context, input *OutputService14TestShapeOutputService14TestCaseOperation1Input, opts ...request.Option) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) { - req, out := c.OutputService14TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService14TestShapeOutputService14TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService14TestShapeOutputService14TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"` -} - -// SetMap sets the Map field's value. -func (s *OutputService14TestShapeOutputService14TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService14TestShapeOutputService14TestCaseOperation1Output { - s.Map = v - return s -} - -// OutputService15ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService15ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService15ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService15ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService15ProtocolTest client from just a session. -// svc := outputservice15protocoltest.New(mySession) -// -// // Create a OutputService15ProtocolTest client with additional configuration -// svc := outputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService15ProtocolTest { - c := p.ClientConfig("outputservice15protocoltest", cfgs...) - return newOutputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService15ProtocolTest { - svc := &OutputService15ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice15protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService15ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService15TestCaseOperation1 = "OperationName" - -// OutputService15TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService15TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService15TestCaseOperation1 for more information on using the OutputService15TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService15TestCaseOperation1Request method. -// req, resp := client.OutputService15TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1Request(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (req *request.Request, output *OutputService15TestShapeOutputService15TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService15TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService15TestShapeOutputService15TestCaseOperation1Input{} - } - - output = &OutputService15TestShapeOutputService15TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService15TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService15TestCaseOperation1 for usage and error information. -func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1(input *OutputService15TestShapeOutputService15TestCaseOperation1Input) (*OutputService15TestShapeOutputService15TestCaseOperation1Output, error) { - req, out := c.OutputService15TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService15TestCaseOperation1WithContext is the same as OutputService15TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService15TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService15ProtocolTest) OutputService15TestCaseOperation1WithContext(ctx aws.Context, input *OutputService15TestShapeOutputService15TestCaseOperation1Input, opts ...request.Option) (*OutputService15TestShapeOutputService15TestCaseOperation1Output, error) { - req, out := c.OutputService15TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService15TestShapeOutputService15TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService15TestShapeOutputService15TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService15TestShapeOutputService15TestCaseOperation1Output) SetFoo(v string) *OutputService15TestShapeOutputService15TestCaseOperation1Output { - s.Foo = &v - return s -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Zrequest-id")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.Char; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := 1.3, *out.Double; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := false, *out.FalseBool; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := 1.2, *out.Float; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(200), *out.Long; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(123), *out.Num; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "myname", *out.Str; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := true, *out.TrueBool; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("mynamerequest-id")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "myname", *out.Str; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { - svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("dmFsdWU=requestid")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "value", string(out.Blob); e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "abc", *out.ListMember[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "123", *out.ListMember[1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "abc", *out.ListMember[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "123", *out.ListMember[1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "abc", *out.ListMember[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "123", *out.ListMember[1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) { - svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abcrequestid")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "abc", *out.ListMember[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { - svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "firstbar", *out.List[0].Bar; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "firstbaz", *out.List[0].Baz; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "firstfoo", *out.List[0].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "secondbar", *out.List[1].Bar; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "secondbaz", *out.List[1].Baz; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "secondfoo", *out.List[1].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) { - svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "firstbar", *out.List[0].Bar; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "firstbaz", *out.List[0].Baz; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "firstfoo", *out.List[0].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "secondbar", *out.List[1].Bar; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "secondbaz", *out.List[1].Baz; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "secondfoo", *out.List[1].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abrequestid")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.List[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "b", *out.List[1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { - svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "bam", *out.Map["baz"].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "bar", *out.Map["qux"].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { - svc := NewOutputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService12TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "bam", *out.Map["baz"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "bar", *out.Map["qux"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) { - svc := NewOutputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarrequestid")) - req, out := svc.OutputService13TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "bar", *out.Map["qux"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { - svc := NewOutputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService14TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "bam", *out.Map["baz"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "bar", *out.Map["qux"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService15ProtocolTestEmptyStringCase1(t *testing.T) { - svc := NewOutputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("requestid")) - req, out := svc.OutputService15TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "", *out.Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go deleted file mode 100644 index 71618356..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ /dev/null @@ -1,290 +0,0 @@ -// Package rest provides RESTful serialization of AWS requests and responses. -package rest - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" - "path" - "reflect" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// RFC822 returns an RFC822 formatted timestamp for AWS protocols -const RFC822 = "Mon, 2 Jan 2006 15:04:05 GMT" - -// Whether the byte value can be sent without escaping in AWS URLs -var noEscape [256]bool - -var errValueNotSet = fmt.Errorf("value not set") - -func init() { - for i := 0; i < len(noEscape); i++ { - // AWS expects every character except these to be escaped - noEscape[i] = (i >= 'A' && i <= 'Z') || - (i >= 'a' && i <= 'z') || - (i >= '0' && i <= '9') || - i == '-' || - i == '.' || - i == '_' || - i == '~' - } -} - -// BuildHandler is a named request handler for building rest protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.rest.Build", Fn: Build} - -// Build builds the REST component of a service request. -func Build(r *request.Request) { - if r.ParamsFilled() { - v := reflect.ValueOf(r.Params).Elem() - buildLocationElements(r, v, false) - buildBody(r, v) - } -} - -// BuildAsGET builds the REST component of a service request with the ability to hoist -// data from the body. -func BuildAsGET(r *request.Request) { - if r.ParamsFilled() { - v := reflect.ValueOf(r.Params).Elem() - buildLocationElements(r, v, true) - buildBody(r, v) - } -} - -func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bool) { - query := r.HTTPRequest.URL.Query() - - // Setup the raw path to match the base path pattern. This is needed - // so that when the path is mutated a custom escaped version can be - // stored in RawPath that will be used by the Go client. - r.HTTPRequest.URL.RawPath = r.HTTPRequest.URL.Path - - for i := 0; i < v.NumField(); i++ { - m := v.Field(i) - if n := v.Type().Field(i).Name; n[0:1] == strings.ToLower(n[0:1]) { - continue - } - - if m.IsValid() { - field := v.Type().Field(i) - name := field.Tag.Get("locationName") - if name == "" { - name = field.Name - } - if kind := m.Kind(); kind == reflect.Ptr { - m = m.Elem() - } else if kind == reflect.Interface { - if !m.Elem().IsValid() { - continue - } - } - if !m.IsValid() { - continue - } - if field.Tag.Get("ignore") != "" { - continue - } - - var err error - switch field.Tag.Get("location") { - case "headers": // header maps - err = buildHeaderMap(&r.HTTPRequest.Header, m, field.Tag) - case "header": - err = buildHeader(&r.HTTPRequest.Header, m, name, field.Tag) - case "uri": - err = buildURI(r.HTTPRequest.URL, m, name, field.Tag) - case "querystring": - err = buildQueryString(query, m, name, field.Tag) - default: - if buildGETQuery { - err = buildQueryString(query, m, name, field.Tag) - } - } - r.Error = err - } - if r.Error != nil { - return - } - } - - r.HTTPRequest.URL.RawQuery = query.Encode() - if !aws.BoolValue(r.Config.DisableRestProtocolURICleaning) { - cleanPath(r.HTTPRequest.URL) - } -} - -func buildBody(r *request.Request, v reflect.Value) { - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - pfield, _ := v.Type().FieldByName(payloadName) - if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { - payload := reflect.Indirect(v.FieldByName(payloadName)) - if payload.IsValid() && payload.Interface() != nil { - switch reader := payload.Interface().(type) { - case io.ReadSeeker: - r.SetReaderBody(reader) - case []byte: - r.SetBufferBody(reader) - case string: - r.SetStringBody(reader) - default: - r.Error = awserr.New("SerializationError", - "failed to encode REST request", - fmt.Errorf("unknown payload type %s", payload.Type())) - } - } - } - } - } -} - -func buildHeader(header *http.Header, v reflect.Value, name string, tag reflect.StructTag) error { - str, err := convertType(v, tag) - if err == errValueNotSet { - return nil - } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) - } - - header.Add(name, str) - - return nil -} - -func buildHeaderMap(header *http.Header, v reflect.Value, tag reflect.StructTag) error { - prefix := tag.Get("locationName") - for _, key := range v.MapKeys() { - str, err := convertType(v.MapIndex(key), tag) - if err == errValueNotSet { - continue - } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) - - } - - header.Add(prefix+key.String(), str) - } - return nil -} - -func buildURI(u *url.URL, v reflect.Value, name string, tag reflect.StructTag) error { - value, err := convertType(v, tag) - if err == errValueNotSet { - return nil - } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) - } - - u.Path = strings.Replace(u.Path, "{"+name+"}", value, -1) - u.Path = strings.Replace(u.Path, "{"+name+"+}", value, -1) - - u.RawPath = strings.Replace(u.RawPath, "{"+name+"}", EscapePath(value, true), -1) - u.RawPath = strings.Replace(u.RawPath, "{"+name+"+}", EscapePath(value, false), -1) - - return nil -} - -func buildQueryString(query url.Values, v reflect.Value, name string, tag reflect.StructTag) error { - switch value := v.Interface().(type) { - case []*string: - for _, item := range value { - query.Add(name, *item) - } - case map[string]*string: - for key, item := range value { - query.Add(key, *item) - } - case map[string][]*string: - for key, items := range value { - for _, item := range items { - query.Add(key, *item) - } - } - default: - str, err := convertType(v, tag) - if err == errValueNotSet { - return nil - } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) - } - query.Set(name, str) - } - - return nil -} - -func cleanPath(u *url.URL) { - hasSlash := strings.HasSuffix(u.Path, "/") - - // clean up path, removing duplicate `/` - u.Path = path.Clean(u.Path) - u.RawPath = path.Clean(u.RawPath) - - if hasSlash && !strings.HasSuffix(u.Path, "/") { - u.Path += "/" - u.RawPath += "/" - } -} - -// EscapePath escapes part of a URL path in Amazon style -func EscapePath(path string, encodeSep bool) string { - var buf bytes.Buffer - for i := 0; i < len(path); i++ { - c := path[i] - if noEscape[c] || (c == '/' && !encodeSep) { - buf.WriteByte(c) - } else { - fmt.Fprintf(&buf, "%%%02X", c) - } - } - return buf.String() -} - -func convertType(v reflect.Value, tag reflect.StructTag) (string, error) { - v = reflect.Indirect(v) - if !v.IsValid() { - return "", errValueNotSet - } - - var str string - switch value := v.Interface().(type) { - case string: - str = value - case []byte: - str = base64.StdEncoding.EncodeToString(value) - case bool: - str = strconv.FormatBool(value) - case int64: - str = strconv.FormatInt(value, 10) - case float64: - str = strconv.FormatFloat(value, 'f', -1, 64) - case time.Time: - str = value.UTC().Format(RFC822) - case aws.JSONValue: - b, err := json.Marshal(value) - if err != nil { - return "", err - } - if tag.Get("location") == "header" { - str = base64.StdEncoding.EncodeToString(b) - } else { - str = string(b) - } - default: - err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) - return "", err - } - return str, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build_test.go deleted file mode 100644 index 9f18081a..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package rest - -import ( - "net/http" - "net/url" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -func TestCleanPath(t *testing.T) { - uri := &url.URL{ - Path: "//foo//bar", - Scheme: "https", - Host: "host", - } - cleanPath(uri) - - expected := "https://host/foo/bar" - if a, e := uri.String(), expected; a != e { - t.Errorf("expect %q URI, got %q", e, a) - } -} - -func TestMarshalPath(t *testing.T) { - in := struct { - Bucket *string `location:"uri" locationName:"bucket"` - Key *string `location:"uri" locationName:"key"` - }{ - Bucket: aws.String("mybucket"), - Key: aws.String("my/cool+thing space/object世界"), - } - - expectURL := `/mybucket/my/cool+thing space/object世界` - expectEscapedURL := `/mybucket/my/cool%2Bthing%20space/object%E4%B8%96%E7%95%8C` - - req := &request.Request{ - HTTPRequest: &http.Request{ - URL: &url.URL{Scheme: "https", Host: "exmaple.com", Path: "/{bucket}/{key+}"}, - }, - Params: &in, - } - - Build(req) - - if req.Error != nil { - t.Fatalf("unexpected error, %v", req.Error) - } - - if a, e := req.HTTPRequest.URL.Path, expectURL; a != e { - t.Errorf("expect %q URI, got %q", e, a) - } - - if a, e := req.HTTPRequest.URL.RawPath, expectEscapedURL; a != e { - t.Errorf("expect %q escaped URI, got %q", e, a) - } - - if a, e := req.HTTPRequest.URL.EscapedPath(), expectEscapedURL; a != e { - t.Errorf("expect %q escaped URI, got %q", e, a) - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go deleted file mode 100644 index 4366de2e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go +++ /dev/null @@ -1,45 +0,0 @@ -package rest - -import "reflect" - -// PayloadMember returns the payload field member of i if there is one, or nil. -func PayloadMember(i interface{}) interface{} { - if i == nil { - return nil - } - - v := reflect.ValueOf(i).Elem() - if !v.IsValid() { - return nil - } - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - field, _ := v.Type().FieldByName(payloadName) - if field.Tag.Get("type") != "structure" { - return nil - } - - payload := v.FieldByName(payloadName) - if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { - return payload.Interface() - } - } - } - return nil -} - -// PayloadType returns the type of a payload field member of i if there is one, or "". -func PayloadType(i interface{}) string { - v := reflect.Indirect(reflect.ValueOf(i)) - if !v.IsValid() { - return "" - } - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - if member, ok := v.Type().FieldByName(payloadName); ok { - return member.Tag.Get("type") - } - } - } - return "" -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go deleted file mode 100644 index 46457b27..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/rest_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package rest_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -func TestUnsetHeaders(t *testing.T) { - cfg := &aws.Config{Region: aws.String("us-west-2")} - c := unit.Session.ClientConfig("testService", cfg) - svc := client.New( - *cfg, - metadata.ClientInfo{ - ServiceName: "testService", - SigningName: c.SigningName, - SigningRegion: c.SigningRegion, - Endpoint: c.Endpoint, - APIVersion: "", - }, - c.Handlers, - ) - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(rest.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(rest.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(rest.UnmarshalMetaHandler) - op := &request.Operation{ - Name: "test-operation", - HTTPPath: "/", - } - - input := &struct { - Foo aws.JSONValue `location:"header" locationName:"x-amz-foo" type:"jsonvalue"` - Bar aws.JSONValue `location:"header" locationName:"x-amz-bar" type:"jsonvalue"` - }{} - - output := &struct { - Foo aws.JSONValue `location:"header" locationName:"x-amz-foo" type:"jsonvalue"` - Bar aws.JSONValue `location:"header" locationName:"x-amz-bar" type:"jsonvalue"` - }{} - - req := svc.NewRequest(op, input, output) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewBuffer(nil)), Header: http.Header{}} - req.HTTPResponse.Header.Set("X-Amz-Foo", "e30=") - - // unmarshal response - rest.UnmarshalMeta(req) - rest.Unmarshal(req) - if req.Error != nil { - t.Fatal(req.Error) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go deleted file mode 100644 index 7a779ee2..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ /dev/null @@ -1,227 +0,0 @@ -package rest - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "reflect" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// UnmarshalHandler is a named request handler for unmarshaling rest protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.rest.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling rest protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.rest.UnmarshalMeta", Fn: UnmarshalMeta} - -// Unmarshal unmarshals the REST component of a response in a REST service. -func Unmarshal(r *request.Request) { - if r.DataFilled() { - v := reflect.Indirect(reflect.ValueOf(r.Data)) - unmarshalBody(r, v) - } -} - -// UnmarshalMeta unmarshals the REST metadata of a response in a REST service -func UnmarshalMeta(r *request.Request) { - r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") - if r.RequestID == "" { - // Alternative version of request id in the header - r.RequestID = r.HTTPResponse.Header.Get("X-Amz-Request-Id") - } - if r.DataFilled() { - v := reflect.Indirect(reflect.ValueOf(r.Data)) - unmarshalLocationElements(r, v) - } -} - -func unmarshalBody(r *request.Request, v reflect.Value) { - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - pfield, _ := v.Type().FieldByName(payloadName) - if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { - payload := v.FieldByName(payloadName) - if payload.IsValid() { - switch payload.Interface().(type) { - case []byte: - defer r.HTTPResponse.Body.Close() - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) - } else { - payload.Set(reflect.ValueOf(b)) - } - case *string: - defer r.HTTPResponse.Body.Close() - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) - } else { - str := string(b) - payload.Set(reflect.ValueOf(&str)) - } - default: - switch payload.Type().String() { - case "io.ReadCloser": - payload.Set(reflect.ValueOf(r.HTTPResponse.Body)) - case "io.ReadSeeker": - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", - "failed to read response body", err) - return - } - payload.Set(reflect.ValueOf(ioutil.NopCloser(bytes.NewReader(b)))) - default: - io.Copy(ioutil.Discard, r.HTTPResponse.Body) - defer r.HTTPResponse.Body.Close() - r.Error = awserr.New("SerializationError", - "failed to decode REST response", - fmt.Errorf("unknown payload type %s", payload.Type())) - } - } - } - } - } - } -} - -func unmarshalLocationElements(r *request.Request, v reflect.Value) { - for i := 0; i < v.NumField(); i++ { - m, field := v.Field(i), v.Type().Field(i) - if n := field.Name; n[0:1] == strings.ToLower(n[0:1]) { - continue - } - - if m.IsValid() { - name := field.Tag.Get("locationName") - if name == "" { - name = field.Name - } - - switch field.Tag.Get("location") { - case "statusCode": - unmarshalStatusCode(m, r.HTTPResponse.StatusCode) - case "header": - err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name), field.Tag) - if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) - break - } - case "headers": - prefix := field.Tag.Get("locationName") - err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix) - if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST response", err) - break - } - } - } - if r.Error != nil { - return - } - } -} - -func unmarshalStatusCode(v reflect.Value, statusCode int) { - if !v.IsValid() { - return - } - - switch v.Interface().(type) { - case *int64: - s := int64(statusCode) - v.Set(reflect.ValueOf(&s)) - } -} - -func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) error { - switch r.Interface().(type) { - case map[string]*string: // we only support string map value types - out := map[string]*string{} - for k, v := range headers { - k = http.CanonicalHeaderKey(k) - if strings.HasPrefix(strings.ToLower(k), strings.ToLower(prefix)) { - out[k[len(prefix):]] = &v[0] - } - } - r.Set(reflect.ValueOf(out)) - } - return nil -} - -func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) error { - isJSONValue := tag.Get("type") == "jsonvalue" - if isJSONValue { - if len(header) == 0 { - return nil - } - } else if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { - return nil - } - - switch v.Interface().(type) { - case *string: - v.Set(reflect.ValueOf(&header)) - case []byte: - b, err := base64.StdEncoding.DecodeString(header) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&b)) - case *bool: - b, err := strconv.ParseBool(header) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&b)) - case *int64: - i, err := strconv.ParseInt(header, 10, 64) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&i)) - case *float64: - f, err := strconv.ParseFloat(header, 64) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&f)) - case *time.Time: - t, err := time.Parse(RFC822, header) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&t)) - case aws.JSONValue: - b := []byte(header) - var err error - if tag.Get("location") == "header" { - b, err = base64.StdEncoding.DecodeString(header) - if err != nil { - return err - } - } - - m := aws.JSONValue{} - err = json.Unmarshal(b, &m) - if err != nil { - return err - } - v.Set(reflect.ValueOf(m)) - default: - err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) - return err - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_bench_test.go deleted file mode 100644 index 7a8a8c2c..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_bench_test.go +++ /dev/null @@ -1,350 +0,0 @@ -// +build bench - -package restjson_test - -import ( - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/private/protocol/restjson" - "github.com/aws/aws-sdk-go/service/elastictranscoder" -) - -var ( - elastictranscoderSvc *elastictranscoder.ElasticTranscoder -) - -func TestMain(m *testing.M) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - })) - - sess := session.Must(session.NewSession(&aws.Config{ - Credentials: credentials.NewStaticCredentials("Key", "Secret", "Token"), - Endpoint: aws.String(server.URL), - S3ForcePathStyle: aws.Bool(true), - DisableSSL: aws.Bool(true), - Region: aws.String(endpoints.UsWest2RegionID), - })) - elastictranscoderSvc = elastictranscoder.New(sess) - - c := m.Run() - server.Close() - os.Exit(c) -} - -func BenchmarkRESTJSONBuild_Complex_ETCCreateJob(b *testing.B) { - params := elastictranscoderCreateJobInput() - - benchRESTJSONBuild(b, func() *request.Request { - req, _ := elastictranscoderSvc.CreateJobRequest(params) - return req - }) -} - -func BenchmarkRESTJSONBuild_Simple_ETCListJobsByPipeline(b *testing.B) { - params := elastictranscoderListJobsByPipeline() - - benchRESTJSONBuild(b, func() *request.Request { - req, _ := elastictranscoderSvc.ListJobsByPipelineRequest(params) - return req - }) -} - -func BenchmarkRESTJSONRequest_Complex_CFCreateJob(b *testing.B) { - benchRESTJSONRequest(b, func() *request.Request { - req, _ := elastictranscoderSvc.CreateJobRequest(elastictranscoderCreateJobInput()) - return req - }) -} - -func BenchmarkRESTJSONRequest_Simple_ETCListJobsByPipeline(b *testing.B) { - benchRESTJSONRequest(b, func() *request.Request { - req, _ := elastictranscoderSvc.ListJobsByPipelineRequest(elastictranscoderListJobsByPipeline()) - return req - }) -} - -func benchRESTJSONBuild(b *testing.B, reqFn func() *request.Request) { - b.ResetTimer() - - for i := 0; i < b.N; i++ { - req := reqFn() - restjson.Build(req) - if req.Error != nil { - b.Fatal("Unexpected error", req.Error) - } - } -} - -func benchRESTJSONRequest(b *testing.B, reqFn func() *request.Request) { - b.ResetTimer() - - for i := 0; i < b.N; i++ { - err := reqFn().Send() - if err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func elastictranscoderListJobsByPipeline() *elastictranscoder.ListJobsByPipelineInput { - return &elastictranscoder.ListJobsByPipelineInput{ - PipelineId: aws.String("Id"), // Required - Ascending: aws.String("Ascending"), - PageToken: aws.String("Id"), - } -} - -func elastictranscoderCreateJobInput() *elastictranscoder.CreateJobInput { - return &elastictranscoder.CreateJobInput{ - Input: &elastictranscoder.JobInput{ // Required - AspectRatio: aws.String("AspectRatio"), - Container: aws.String("JobContainer"), - DetectedProperties: &elastictranscoder.DetectedProperties{ - DurationMillis: aws.Int64(1), - FileSize: aws.Int64(1), - FrameRate: aws.String("FloatString"), - Height: aws.Int64(1), - Width: aws.Int64(1), - }, - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - FrameRate: aws.String("FrameRate"), - Interlaced: aws.String("Interlaced"), - Key: aws.String("Key"), - Resolution: aws.String("Resolution"), - }, - PipelineId: aws.String("Id"), // Required - Output: &elastictranscoder.CreateJobOutput{ - AlbumArt: &elastictranscoder.JobAlbumArt{ - Artwork: []*elastictranscoder.Artwork{ - { // Required - AlbumArtFormat: aws.String("JpgOrPng"), - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - MaxHeight: aws.String("DigitsOrAuto"), - MaxWidth: aws.String("DigitsOrAuto"), - PaddingPolicy: aws.String("PaddingPolicy"), - SizingPolicy: aws.String("SizingPolicy"), - }, - // More values... - }, - MergePolicy: aws.String("MergePolicy"), - }, - Captions: &elastictranscoder.Captions{ - CaptionFormats: []*elastictranscoder.CaptionFormat{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Format: aws.String("CaptionFormatFormat"), - Pattern: aws.String("CaptionFormatPattern"), - }, - // More values... - }, - CaptionSources: []*elastictranscoder.CaptionSource{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - Label: aws.String("Name"), - Language: aws.String("Key"), - TimeOffset: aws.String("TimeOffset"), - }, - // More values... - }, - MergePolicy: aws.String("CaptionMergePolicy"), - }, - Composition: []*elastictranscoder.Clip{ - { // Required - TimeSpan: &elastictranscoder.TimeSpan{ - Duration: aws.String("Time"), - StartTime: aws.String("Time"), - }, - }, - // More values... - }, - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - PresetId: aws.String("Id"), - Rotate: aws.String("Rotate"), - SegmentDuration: aws.String("FloatString"), - ThumbnailEncryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - ThumbnailPattern: aws.String("ThumbnailPattern"), - Watermarks: []*elastictranscoder.JobWatermark{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - PresetWatermarkId: aws.String("PresetWatermarkId"), - }, - // More values... - }, - }, - OutputKeyPrefix: aws.String("Key"), - Outputs: []*elastictranscoder.CreateJobOutput{ - { // Required - AlbumArt: &elastictranscoder.JobAlbumArt{ - Artwork: []*elastictranscoder.Artwork{ - { // Required - AlbumArtFormat: aws.String("JpgOrPng"), - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - MaxHeight: aws.String("DigitsOrAuto"), - MaxWidth: aws.String("DigitsOrAuto"), - PaddingPolicy: aws.String("PaddingPolicy"), - SizingPolicy: aws.String("SizingPolicy"), - }, - // More values... - }, - MergePolicy: aws.String("MergePolicy"), - }, - Captions: &elastictranscoder.Captions{ - CaptionFormats: []*elastictranscoder.CaptionFormat{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Format: aws.String("CaptionFormatFormat"), - Pattern: aws.String("CaptionFormatPattern"), - }, - // More values... - }, - CaptionSources: []*elastictranscoder.CaptionSource{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - Label: aws.String("Name"), - Language: aws.String("Key"), - TimeOffset: aws.String("TimeOffset"), - }, - // More values... - }, - MergePolicy: aws.String("CaptionMergePolicy"), - }, - Composition: []*elastictranscoder.Clip{ - { // Required - TimeSpan: &elastictranscoder.TimeSpan{ - Duration: aws.String("Time"), - StartTime: aws.String("Time"), - }, - }, - // More values... - }, - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - Key: aws.String("Key"), - PresetId: aws.String("Id"), - Rotate: aws.String("Rotate"), - SegmentDuration: aws.String("FloatString"), - ThumbnailEncryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - ThumbnailPattern: aws.String("ThumbnailPattern"), - Watermarks: []*elastictranscoder.JobWatermark{ - { // Required - Encryption: &elastictranscoder.Encryption{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - Mode: aws.String("EncryptionMode"), - }, - InputKey: aws.String("WatermarkKey"), - PresetWatermarkId: aws.String("PresetWatermarkId"), - }, - // More values... - }, - }, - // More values... - }, - Playlists: []*elastictranscoder.CreateJobPlaylist{ - { // Required - Format: aws.String("PlaylistFormat"), - HlsContentProtection: &elastictranscoder.HlsContentProtection{ - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("Base64EncodedString"), - KeyMd5: aws.String("Base64EncodedString"), - KeyStoragePolicy: aws.String("KeyStoragePolicy"), - LicenseAcquisitionUrl: aws.String("ZeroTo512String"), - Method: aws.String("HlsContentProtectionMethod"), - }, - Name: aws.String("Filename"), - OutputKeys: []*string{ - aws.String("Key"), // Required - // More values... - }, - PlayReadyDrm: &elastictranscoder.PlayReadyDrm{ - Format: aws.String("PlayReadyDrmFormatString"), - InitializationVector: aws.String("ZeroTo255String"), - Key: aws.String("NonEmptyBase64EncodedString"), - KeyId: aws.String("KeyIdGuid"), - KeyMd5: aws.String("NonEmptyBase64EncodedString"), - LicenseAcquisitionUrl: aws.String("OneTo512String"), - }, - }, - // More values... - }, - UserMetadata: map[string]*string{ - "Key": aws.String("String"), // Required - // More values... - }, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_test.go deleted file mode 100644 index ac4e4d18..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/build_test.go +++ /dev/null @@ -1,5140 +0,0 @@ -package restjson_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/restjson" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/util" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String -var _ = fmt.Println -var _ = reflect.Value{} - -func init() { - protocol.RandReader = &awstesting.ZeroReader{} -} - -// InputService1ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService1ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService1ProtocolTest client from just a session. -// svc := inputservice1protocoltest.New(mySession) -// -// // Create a InputService1ProtocolTest client with additional configuration -// svc := inputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService1ProtocolTest { - c := p.ClientConfig("inputservice1protocoltest", cfgs...) - return newInputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService1ProtocolTest { - svc := &InputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice1protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService1TestCaseOperation1 = "OperationName" - -// InputService1TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService1TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService1TestCaseOperation1 for more information on using the InputService1TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService1TestCaseOperation1Request method. -// req, resp := client.InputService1TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobs", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation1Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService1TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService1TestCaseOperation1 for usage and error information. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService1TestCaseOperation1WithContext is the same as InputService1TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService1TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1WithContext(ctx aws.Context, input *InputService1TestShapeInputService1TestCaseOperation1Input, opts ...request.Option) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { - req, out := c.InputService1TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService1TestShapeInputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService2ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService2ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService2ProtocolTest client from just a session. -// svc := inputservice2protocoltest.New(mySession) -// -// // Create a InputService2ProtocolTest client with additional configuration -// svc := inputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService2ProtocolTest { - c := p.ClientConfig("inputservice2protocoltest", cfgs...) - return newInputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService2ProtocolTest { - svc := &InputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice2protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService2TestCaseOperation1 = "OperationName" - -// InputService2TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService2TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService2TestCaseOperation1 for more information on using the InputService2TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService2TestCaseOperation1Request method. -// req, resp := client.InputService2TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService2TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService2TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService2TestCaseOperation1 for usage and error information. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService2TestCaseOperation1WithContext is the same as InputService2TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService2TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1WithContext(ctx aws.Context, input *InputService2TestShapeInputService2TestCaseOperation1Input, opts ...request.Option) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { - req, out := c.InputService2TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService2TestShapeInputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` -} - -// SetPipelineId sets the PipelineId field's value. -func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetPipelineId(v string) *InputService2TestShapeInputService2TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService3ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService3ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService3ProtocolTest client from just a session. -// svc := inputservice3protocoltest.New(mySession) -// -// // Create a InputService3ProtocolTest client with additional configuration -// svc := inputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService3ProtocolTest { - c := p.ClientConfig("inputservice3protocoltest", cfgs...) - return newInputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService3ProtocolTest { - svc := &InputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice3protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService3TestCaseOperation1 = "OperationName" - -// InputService3TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService3TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService3TestCaseOperation1 for more information on using the InputService3TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService3TestCaseOperation1Request method. -// req, resp := client.InputService3TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService3TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation1Input{} - } - - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService3TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService3TestCaseOperation1 for usage and error information. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService3TestCaseOperation1WithContext is the same as InputService3TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService3TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1WithContext(ctx aws.Context, input *InputService3TestShapeInputService3TestCaseOperation1Input, opts ...request.Option) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { - req, out := c.InputService3TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService3TestShapeInputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Foo *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService3TestShapeInputService3TestCaseOperation1Input) SetFoo(v string) *InputService3TestShapeInputService3TestCaseOperation1Input { - s.Foo = &v - return s -} - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService4ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService4ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService4ProtocolTest client from just a session. -// svc := inputservice4protocoltest.New(mySession) -// -// // Create a InputService4ProtocolTest client with additional configuration -// svc := inputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService4ProtocolTest { - c := p.ClientConfig("inputservice4protocoltest", cfgs...) - return newInputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService4ProtocolTest { - svc := &InputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice4protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService4TestCaseOperation1 = "OperationName" - -// InputService4TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService4TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService4TestCaseOperation1 for more information on using the InputService4TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService4TestCaseOperation1Request method. -// req, resp := client.InputService4TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService4TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} - } - - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService4TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService4TestCaseOperation1 for usage and error information. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService4TestCaseOperation1WithContext is the same as InputService4TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService4TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1WithContext(ctx aws.Context, input *InputService4TestShapeInputService4TestCaseOperation1Input, opts ...request.Option) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { - req, out := c.InputService4TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService4TestShapeInputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Items []*string `location:"querystring" locationName:"item" type:"list"` -} - -// SetItems sets the Items field's value. -func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetItems(v []*string) *InputService4TestShapeInputService4TestCaseOperation1Input { - s.Items = v - return s -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService5ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService5ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService5ProtocolTest client from just a session. -// svc := inputservice5protocoltest.New(mySession) -// -// // Create a InputService5ProtocolTest client with additional configuration -// svc := inputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService5ProtocolTest { - c := p.ClientConfig("inputservice5protocoltest", cfgs...) - return newInputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService5ProtocolTest { - svc := &InputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice5protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService5TestCaseOperation1 = "OperationName" - -// InputService5TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService5TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService5TestCaseOperation1 for more information on using the InputService5TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService5TestCaseOperation1Request method. -// req, resp := client.InputService5TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService5TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation1Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService5TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService5TestCaseOperation1 for usage and error information. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService5TestCaseOperation1WithContext is the same as InputService5TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService5TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1WithContext(ctx aws.Context, input *InputService5TestShapeInputService5TestCaseOperation1Input, opts ...request.Option) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { - req, out := c.InputService5TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService5TestShapeInputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` - - QueryDoc map[string]*string `location:"querystring" type:"map"` -} - -// SetPipelineId sets the PipelineId field's value. -func (s *InputService5TestShapeInputService5TestCaseOperation1Input) SetPipelineId(v string) *InputService5TestShapeInputService5TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -// SetQueryDoc sets the QueryDoc field's value. -func (s *InputService5TestShapeInputService5TestCaseOperation1Input) SetQueryDoc(v map[string]*string) *InputService5TestShapeInputService5TestCaseOperation1Input { - s.QueryDoc = v - return s -} - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService6ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService6ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService6ProtocolTest client from just a session. -// svc := inputservice6protocoltest.New(mySession) -// -// // Create a InputService6ProtocolTest client with additional configuration -// svc := inputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService6ProtocolTest { - c := p.ClientConfig("inputservice6protocoltest", cfgs...) - return newInputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService6ProtocolTest { - svc := &InputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice6protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService6TestCaseOperation1 = "OperationName" - -// InputService6TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService6TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService6TestCaseOperation1 for more information on using the InputService6TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService6TestCaseOperation1Request method. -// req, resp := client.InputService6TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService6TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService6TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService6TestCaseOperation1 for usage and error information. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService6TestCaseOperation1WithContext is the same as InputService6TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService6TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1WithContext(ctx aws.Context, input *InputService6TestShapeInputService6TestCaseOperation1Input, opts ...request.Option) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { - req, out := c.InputService6TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService6TestShapeInputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - PipelineId *string `location:"uri" type:"string"` - - QueryDoc map[string][]*string `location:"querystring" type:"map"` -} - -// SetPipelineId sets the PipelineId field's value. -func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetPipelineId(v string) *InputService6TestShapeInputService6TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -// SetQueryDoc sets the QueryDoc field's value. -func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetQueryDoc(v map[string][]*string) *InputService6TestShapeInputService6TestCaseOperation1Input { - s.QueryDoc = v - return s -} - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService7ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService7ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService7ProtocolTest client from just a session. -// svc := inputservice7protocoltest.New(mySession) -// -// // Create a InputService7ProtocolTest client with additional configuration -// svc := inputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService7ProtocolTest { - c := p.ClientConfig("inputservice7protocoltest", cfgs...) - return newInputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService7ProtocolTest { - svc := &InputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice7protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService7TestCaseOperation1 = "OperationName" - -// InputService7TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService7TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService7TestCaseOperation1 for more information on using the InputService7TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService7TestCaseOperation1Request method. -// req, resp := client.InputService7TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation2Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation2Input{} - } - - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService7TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService7TestCaseOperation1 for usage and error information. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation2Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService7TestCaseOperation1WithContext is the same as InputService7TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService7TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1WithContext(ctx aws.Context, input *InputService7TestShapeInputService7TestCaseOperation2Input, opts ...request.Option) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { - req, out := c.InputService7TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService7TestCaseOperation2 = "OperationName" - -// InputService7TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService7TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService7TestCaseOperation2 for more information on using the InputService7TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService7TestCaseOperation2Request method. -// req, resp := client.InputService7TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService7ProtocolTest) InputService7TestCaseOperation2Request(input *InputService7TestShapeInputService7TestCaseOperation2Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService7TestCaseOperation2, - HTTPMethod: "GET", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation2Input{} - } - - output = &InputService7TestShapeInputService7TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService7TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService7TestCaseOperation2 for usage and error information. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation2(input *InputService7TestShapeInputService7TestCaseOperation2Input) (*InputService7TestShapeInputService7TestCaseOperation2Output, error) { - req, out := c.InputService7TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService7TestCaseOperation2WithContext is the same as InputService7TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService7TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation2WithContext(ctx aws.Context, input *InputService7TestShapeInputService7TestCaseOperation2Input, opts ...request.Option) (*InputService7TestShapeInputService7TestCaseOperation2Output, error) { - req, out := c.InputService7TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService7TestShapeInputService7TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - BoolQuery *bool `location:"querystring" locationName:"bool-query" type:"boolean"` -} - -// SetBoolQuery sets the BoolQuery field's value. -func (s *InputService7TestShapeInputService7TestCaseOperation2Input) SetBoolQuery(v bool) *InputService7TestShapeInputService7TestCaseOperation2Input { - s.BoolQuery = &v - return s -} - -type InputService7TestShapeInputService7TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService8ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService8ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService8ProtocolTest client from just a session. -// svc := inputservice8protocoltest.New(mySession) -// -// // Create a InputService8ProtocolTest client with additional configuration -// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest { - c := p.ClientConfig("inputservice8protocoltest", cfgs...) - return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService8ProtocolTest { - svc := &InputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice8protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService8TestCaseOperation1 = "OperationName" - -// InputService8TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService8TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService8TestCaseOperation1 for more information on using the InputService8TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService8TestCaseOperation1Request method. -// req, resp := client.InputService8TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService8TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService8TestShapeInputService8TestCaseOperation1Input{} - } - - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService8TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService8TestCaseOperation1 for usage and error information. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService8TestCaseOperation1WithContext is the same as InputService8TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService8TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1WithContext(ctx aws.Context, input *InputService8TestShapeInputService8TestCaseOperation1Input, opts ...request.Option) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { - req, out := c.InputService8TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService8TestShapeInputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -// SetAscending sets the Ascending field's value. -func (s *InputService8TestShapeInputService8TestCaseOperation1Input) SetAscending(v string) *InputService8TestShapeInputService8TestCaseOperation1Input { - s.Ascending = &v - return s -} - -// SetPageToken sets the PageToken field's value. -func (s *InputService8TestShapeInputService8TestCaseOperation1Input) SetPageToken(v string) *InputService8TestShapeInputService8TestCaseOperation1Input { - s.PageToken = &v - return s -} - -// SetPipelineId sets the PipelineId field's value. -func (s *InputService8TestShapeInputService8TestCaseOperation1Input) SetPipelineId(v string) *InputService8TestShapeInputService8TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -type InputService8TestShapeInputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService9ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService9ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService9ProtocolTest client from just a session. -// svc := inputservice9protocoltest.New(mySession) -// -// // Create a InputService9ProtocolTest client with additional configuration -// svc := inputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService9ProtocolTest { - c := p.ClientConfig("inputservice9protocoltest", cfgs...) - return newInputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService9ProtocolTest { - svc := &InputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice9protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService9TestCaseOperation1 = "OperationName" - -// InputService9TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService9TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService9TestCaseOperation1 for more information on using the InputService9TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService9TestCaseOperation1Request method. -// req, resp := client.InputService9TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService9TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService9TestShapeInputService9TestCaseOperation1Input{} - } - - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService9TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService9TestCaseOperation1 for usage and error information. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { - req, out := c.InputService9TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService9TestCaseOperation1WithContext is the same as InputService9TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService9TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1WithContext(ctx aws.Context, input *InputService9TestShapeInputService9TestCaseOperation1Input, opts ...request.Option) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { - req, out := c.InputService9TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService9TestShapeInputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - Config *InputService9TestShapeStructType `type:"structure"` - - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -// SetAscending sets the Ascending field's value. -func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetAscending(v string) *InputService9TestShapeInputService9TestCaseOperation1Input { - s.Ascending = &v - return s -} - -// SetConfig sets the Config field's value. -func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetConfig(v *InputService9TestShapeStructType) *InputService9TestShapeInputService9TestCaseOperation1Input { - s.Config = v - return s -} - -// SetPageToken sets the PageToken field's value. -func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetPageToken(v string) *InputService9TestShapeInputService9TestCaseOperation1Input { - s.PageToken = &v - return s -} - -// SetPipelineId sets the PipelineId field's value. -func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetPipelineId(v string) *InputService9TestShapeInputService9TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService9TestShapeStructType struct { - _ struct{} `type:"structure"` - - A *string `type:"string"` - - B *string `type:"string"` -} - -// SetA sets the A field's value. -func (s *InputService9TestShapeStructType) SetA(v string) *InputService9TestShapeStructType { - s.A = &v - return s -} - -// SetB sets the B field's value. -func (s *InputService9TestShapeStructType) SetB(v string) *InputService9TestShapeStructType { - s.B = &v - return s -} - -// InputService10ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService10ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService10ProtocolTest client from just a session. -// svc := inputservice10protocoltest.New(mySession) -// -// // Create a InputService10ProtocolTest client with additional configuration -// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest { - c := p.ClientConfig("inputservice10protocoltest", cfgs...) - return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService10ProtocolTest { - svc := &InputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice10protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService10TestCaseOperation1 = "OperationName" - -// InputService10TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService10TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService10TestCaseOperation1 for more information on using the InputService10TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService10TestCaseOperation1Request method. -// req, resp := client.InputService10TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation1Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService10TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService10TestShapeInputService10TestCaseOperation1Input{} - } - - output = &InputService10TestShapeInputService10TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService10TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService10TestCaseOperation1 for usage and error information. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation1Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { - req, out := c.InputService10TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService10TestCaseOperation1WithContext is the same as InputService10TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService10TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1WithContext(ctx aws.Context, input *InputService10TestShapeInputService10TestCaseOperation1Input, opts ...request.Option) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { - req, out := c.InputService10TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService10TestShapeInputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - Checksum *string `location:"header" locationName:"x-amz-checksum" type:"string"` - - Config *InputService10TestShapeStructType `type:"structure"` - - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"` -} - -// SetAscending sets the Ascending field's value. -func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetAscending(v string) *InputService10TestShapeInputService10TestCaseOperation1Input { - s.Ascending = &v - return s -} - -// SetChecksum sets the Checksum field's value. -func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetChecksum(v string) *InputService10TestShapeInputService10TestCaseOperation1Input { - s.Checksum = &v - return s -} - -// SetConfig sets the Config field's value. -func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetConfig(v *InputService10TestShapeStructType) *InputService10TestShapeInputService10TestCaseOperation1Input { - s.Config = v - return s -} - -// SetPageToken sets the PageToken field's value. -func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetPageToken(v string) *InputService10TestShapeInputService10TestCaseOperation1Input { - s.PageToken = &v - return s -} - -// SetPipelineId sets the PipelineId field's value. -func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetPipelineId(v string) *InputService10TestShapeInputService10TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -type InputService10TestShapeInputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService10TestShapeStructType struct { - _ struct{} `type:"structure"` - - A *string `type:"string"` - - B *string `type:"string"` -} - -// SetA sets the A field's value. -func (s *InputService10TestShapeStructType) SetA(v string) *InputService10TestShapeStructType { - s.A = &v - return s -} - -// SetB sets the B field's value. -func (s *InputService10TestShapeStructType) SetB(v string) *InputService10TestShapeStructType { - s.B = &v - return s -} - -// InputService11ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService11ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService11ProtocolTest client from just a session. -// svc := inputservice11protocoltest.New(mySession) -// -// // Create a InputService11ProtocolTest client with additional configuration -// svc := inputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService11ProtocolTest { - c := p.ClientConfig("inputservice11protocoltest", cfgs...) - return newInputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService11ProtocolTest { - svc := &InputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice11protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService11TestCaseOperation1 = "OperationName" - -// InputService11TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService11TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService11TestCaseOperation1 for more information on using the InputService11TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService11TestCaseOperation1Request method. -// req, resp := client.InputService11TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputService11TestCaseOperation1Input) (req *request.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService11TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/vaults/{vaultName}/archives", - } - - if input == nil { - input = &InputService11TestShapeInputService11TestCaseOperation1Input{} - } - - output = &InputService11TestShapeInputService11TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService11TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService11TestCaseOperation1 for usage and error information. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputService11TestCaseOperation1Input) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { - req, out := c.InputService11TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService11TestCaseOperation1WithContext is the same as InputService11TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService11TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1WithContext(ctx aws.Context, input *InputService11TestShapeInputService11TestCaseOperation1Input, opts ...request.Option) (*InputService11TestShapeInputService11TestCaseOperation1Output, error) { - req, out := c.InputService11TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService11TestShapeInputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Body"` - - Body io.ReadSeeker `locationName:"body" type:"blob"` - - Checksum *string `location:"header" locationName:"x-amz-sha256-tree-hash" type:"string"` - - // VaultName is a required field - VaultName *string `location:"uri" locationName:"vaultName" type:"string" required:"true"` -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InputService11TestShapeInputService11TestCaseOperation1Input) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InputService11TestShapeInputService11TestCaseOperation1Input"} - if s.VaultName == nil { - invalidParams.Add(request.NewErrParamRequired("VaultName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBody sets the Body field's value. -func (s *InputService11TestShapeInputService11TestCaseOperation1Input) SetBody(v io.ReadSeeker) *InputService11TestShapeInputService11TestCaseOperation1Input { - s.Body = v - return s -} - -// SetChecksum sets the Checksum field's value. -func (s *InputService11TestShapeInputService11TestCaseOperation1Input) SetChecksum(v string) *InputService11TestShapeInputService11TestCaseOperation1Input { - s.Checksum = &v - return s -} - -// SetVaultName sets the VaultName field's value. -func (s *InputService11TestShapeInputService11TestCaseOperation1Input) SetVaultName(v string) *InputService11TestShapeInputService11TestCaseOperation1Input { - s.VaultName = &v - return s -} - -type InputService11TestShapeInputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService12ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService12ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService12ProtocolTest client from just a session. -// svc := inputservice12protocoltest.New(mySession) -// -// // Create a InputService12ProtocolTest client with additional configuration -// svc := inputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService12ProtocolTest { - c := p.ClientConfig("inputservice12protocoltest", cfgs...) - return newInputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService12ProtocolTest { - svc := &InputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice12protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService12TestCaseOperation1 = "OperationName" - -// InputService12TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService12TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService12TestCaseOperation1 for more information on using the InputService12TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService12TestCaseOperation1Request method. -// req, resp := client.InputService12TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputService12TestCaseOperation1Input) (req *request.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService12TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/{Foo}", - } - - if input == nil { - input = &InputService12TestShapeInputService12TestCaseOperation1Input{} - } - - output = &InputService12TestShapeInputService12TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService12TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService12TestCaseOperation1 for usage and error information. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputService12TestCaseOperation1Input) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { - req, out := c.InputService12TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService12TestCaseOperation1WithContext is the same as InputService12TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService12TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1WithContext(ctx aws.Context, input *InputService12TestShapeInputService12TestCaseOperation1Input, opts ...request.Option) (*InputService12TestShapeInputService12TestCaseOperation1Output, error) { - req, out := c.InputService12TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService12TestShapeInputService12TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - // Bar is automatically base64 encoded/decoded by the SDK. - Bar []byte `type:"blob"` - - // Foo is a required field - Foo *string `location:"uri" locationName:"Foo" type:"string" required:"true"` -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InputService12TestShapeInputService12TestCaseOperation1Input) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InputService12TestShapeInputService12TestCaseOperation1Input"} - if s.Foo == nil { - invalidParams.Add(request.NewErrParamRequired("Foo")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBar sets the Bar field's value. -func (s *InputService12TestShapeInputService12TestCaseOperation1Input) SetBar(v []byte) *InputService12TestShapeInputService12TestCaseOperation1Input { - s.Bar = v - return s -} - -// SetFoo sets the Foo field's value. -func (s *InputService12TestShapeInputService12TestCaseOperation1Input) SetFoo(v string) *InputService12TestShapeInputService12TestCaseOperation1Input { - s.Foo = &v - return s -} - -type InputService12TestShapeInputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService13ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService13ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService13ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService13ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService13ProtocolTest client from just a session. -// svc := inputservice13protocoltest.New(mySession) -// -// // Create a InputService13ProtocolTest client with additional configuration -// svc := inputservice13protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService13ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService13ProtocolTest { - c := p.ClientConfig("inputservice13protocoltest", cfgs...) - return newInputService13ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService13ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService13ProtocolTest { - svc := &InputService13ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice13protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService13TestCaseOperation1 = "OperationName" - -// InputService13TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation1 for more information on using the InputService13TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation1Request method. -// req, resp := client.InputService13TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputService13TestCaseOperation2Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation2Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation1 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *InputService13TestShapeInputService13TestCaseOperation2Input) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) { - req, out := c.InputService13TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation1WithContext is the same as InputService13TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation2Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) { - req, out := c.InputService13TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService13TestCaseOperation2 = "OperationName" - -// InputService13TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService13TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService13TestCaseOperation2 for more information on using the InputService13TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService13TestCaseOperation2Request method. -// req, resp := client.InputService13TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2Request(input *InputService13TestShapeInputService13TestCaseOperation2Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation2Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService13TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService13TestCaseOperation2 for usage and error information. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2(input *InputService13TestShapeInputService13TestCaseOperation2Input) (*InputService13TestShapeInputService13TestCaseOperation2Output, error) { - req, out := c.InputService13TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService13TestCaseOperation2WithContext is the same as InputService13TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService13TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2WithContext(ctx aws.Context, input *InputService13TestShapeInputService13TestCaseOperation2Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation2Output, error) { - req, out := c.InputService13TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService13TestShapeInputService13TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation2Input struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo []byte `locationName:"foo" type:"blob"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService13TestShapeInputService13TestCaseOperation2Input) SetFoo(v []byte) *InputService13TestShapeInputService13TestCaseOperation2Input { - s.Foo = v - return s -} - -type InputService13TestShapeInputService13TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService14ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService14ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService14ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService14ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService14ProtocolTest client from just a session. -// svc := inputservice14protocoltest.New(mySession) -// -// // Create a InputService14ProtocolTest client with additional configuration -// svc := inputservice14protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService14ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService14ProtocolTest { - c := p.ClientConfig("inputservice14protocoltest", cfgs...) - return newInputService14ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService14ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService14ProtocolTest { - svc := &InputService14ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice14protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService14TestCaseOperation1 = "OperationName" - -// InputService14TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService14TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService14TestCaseOperation1 for more information on using the InputService14TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService14TestCaseOperation1Request method. -// req, resp := client.InputService14TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputService14TestCaseOperation2Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService14TestShapeInputService14TestCaseOperation2Input{} - } - - output = &InputService14TestShapeInputService14TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService14TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService14TestCaseOperation1 for usage and error information. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *InputService14TestShapeInputService14TestCaseOperation2Input) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) { - req, out := c.InputService14TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService14TestCaseOperation1WithContext is the same as InputService14TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService14TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1WithContext(ctx aws.Context, input *InputService14TestShapeInputService14TestCaseOperation2Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) { - req, out := c.InputService14TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService14TestCaseOperation2 = "OperationName" - -// InputService14TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService14TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService14TestCaseOperation2 for more information on using the InputService14TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService14TestCaseOperation2Request method. -// req, resp := client.InputService14TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2Request(input *InputService14TestShapeInputService14TestCaseOperation2Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService14TestShapeInputService14TestCaseOperation2Input{} - } - - output = &InputService14TestShapeInputService14TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService14TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService14TestCaseOperation2 for usage and error information. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2(input *InputService14TestShapeInputService14TestCaseOperation2Input) (*InputService14TestShapeInputService14TestCaseOperation2Output, error) { - req, out := c.InputService14TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService14TestCaseOperation2WithContext is the same as InputService14TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService14TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2WithContext(ctx aws.Context, input *InputService14TestShapeInputService14TestCaseOperation2Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation2Output, error) { - req, out := c.InputService14TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService14TestShapeFooShape struct { - _ struct{} `locationName:"foo" type:"structure"` - - Baz *string `locationName:"baz" type:"string"` -} - -// SetBaz sets the Baz field's value. -func (s *InputService14TestShapeFooShape) SetBaz(v string) *InputService14TestShapeFooShape { - s.Baz = &v - return s -} - -type InputService14TestShapeInputService14TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService14TestShapeInputService14TestCaseOperation2Input struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *InputService14TestShapeFooShape `locationName:"foo" type:"structure"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService14TestShapeInputService14TestCaseOperation2Input) SetFoo(v *InputService14TestShapeFooShape) *InputService14TestShapeInputService14TestCaseOperation2Input { - s.Foo = v - return s -} - -type InputService14TestShapeInputService14TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService15ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService15ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService15ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService15ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService15ProtocolTest client from just a session. -// svc := inputservice15protocoltest.New(mySession) -// -// // Create a InputService15ProtocolTest client with additional configuration -// svc := inputservice15protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService15ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService15ProtocolTest { - c := p.ClientConfig("inputservice15protocoltest", cfgs...) - return newInputService15ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService15ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService15ProtocolTest { - svc := &InputService15ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice15protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService15ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService15TestCaseOperation1 = "OperationName" - -// InputService15TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService15TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService15TestCaseOperation1 for more information on using the InputService15TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService15TestCaseOperation1Request method. -// req, resp := client.InputService15TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputService15TestCaseOperation2Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation2Input{} - } - - output = &InputService15TestShapeInputService15TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService15TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService15TestCaseOperation1 for usage and error information. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1(input *InputService15TestShapeInputService15TestCaseOperation2Input) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) { - req, out := c.InputService15TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService15TestCaseOperation1WithContext is the same as InputService15TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService15TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation2Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation1Output, error) { - req, out := c.InputService15TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService15TestCaseOperation2 = "OperationName" - -// InputService15TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService15TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService15TestCaseOperation2 for more information on using the InputService15TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService15TestCaseOperation2Request method. -// req, resp := client.InputService15TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService15ProtocolTest) InputService15TestCaseOperation2Request(input *InputService15TestShapeInputService15TestCaseOperation2Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path?abc=mno", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation2Input{} - } - - output = &InputService15TestShapeInputService15TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService15TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService15TestCaseOperation2 for usage and error information. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation2(input *InputService15TestShapeInputService15TestCaseOperation2Input) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) { - req, out := c.InputService15TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService15TestCaseOperation2WithContext is the same as InputService15TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService15TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation2WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation2Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) { - req, out := c.InputService15TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService15TestShapeInputService15TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService15TestShapeInputService15TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - Foo *string `location:"querystring" locationName:"param-name" type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService15TestShapeInputService15TestCaseOperation2Input) SetFoo(v string) *InputService15TestShapeInputService15TestCaseOperation2Input { - s.Foo = &v - return s -} - -type InputService15TestShapeInputService15TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService16ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService16ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService16ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService16ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService16ProtocolTest client from just a session. -// svc := inputservice16protocoltest.New(mySession) -// -// // Create a InputService16ProtocolTest client with additional configuration -// svc := inputservice16protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService16ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService16ProtocolTest { - c := p.ClientConfig("inputservice16protocoltest", cfgs...) - return newInputService16ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService16ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService16ProtocolTest { - svc := &InputService16ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice16protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService16ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService16TestCaseOperation1 = "OperationName" - -// InputService16TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService16TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService16TestCaseOperation1 for more information on using the InputService16TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService16TestCaseOperation1Request method. -// req, resp := client.InputService16TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService16ProtocolTest) InputService16TestCaseOperation1Request(input *InputService16TestShapeInputService16TestCaseOperation6Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService16TestShapeInputService16TestCaseOperation6Input{} - } - - output = &InputService16TestShapeInputService16TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService16TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService16TestCaseOperation1 for usage and error information. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation1(input *InputService16TestShapeInputService16TestCaseOperation6Input) (*InputService16TestShapeInputService16TestCaseOperation1Output, error) { - req, out := c.InputService16TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService16TestCaseOperation1WithContext is the same as InputService16TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService16TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation1WithContext(ctx aws.Context, input *InputService16TestShapeInputService16TestCaseOperation6Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation1Output, error) { - req, out := c.InputService16TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService16TestCaseOperation2 = "OperationName" - -// InputService16TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService16TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService16TestCaseOperation2 for more information on using the InputService16TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService16TestCaseOperation2Request method. -// req, resp := client.InputService16TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService16ProtocolTest) InputService16TestCaseOperation2Request(input *InputService16TestShapeInputService16TestCaseOperation6Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService16TestShapeInputService16TestCaseOperation6Input{} - } - - output = &InputService16TestShapeInputService16TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService16TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService16TestCaseOperation2 for usage and error information. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation2(input *InputService16TestShapeInputService16TestCaseOperation6Input) (*InputService16TestShapeInputService16TestCaseOperation2Output, error) { - req, out := c.InputService16TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService16TestCaseOperation2WithContext is the same as InputService16TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService16TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation2WithContext(ctx aws.Context, input *InputService16TestShapeInputService16TestCaseOperation6Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation2Output, error) { - req, out := c.InputService16TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService16TestCaseOperation3 = "OperationName" - -// InputService16TestCaseOperation3Request generates a "aws/request.Request" representing the -// client's request for the InputService16TestCaseOperation3 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService16TestCaseOperation3 for more information on using the InputService16TestCaseOperation3 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService16TestCaseOperation3Request method. -// req, resp := client.InputService16TestCaseOperation3Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService16ProtocolTest) InputService16TestCaseOperation3Request(input *InputService16TestShapeInputService16TestCaseOperation6Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation3, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService16TestShapeInputService16TestCaseOperation6Input{} - } - - output = &InputService16TestShapeInputService16TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService16TestCaseOperation3 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService16TestCaseOperation3 for usage and error information. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation3(input *InputService16TestShapeInputService16TestCaseOperation6Input) (*InputService16TestShapeInputService16TestCaseOperation3Output, error) { - req, out := c.InputService16TestCaseOperation3Request(input) - return out, req.Send() -} - -// InputService16TestCaseOperation3WithContext is the same as InputService16TestCaseOperation3 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService16TestCaseOperation3 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation3WithContext(ctx aws.Context, input *InputService16TestShapeInputService16TestCaseOperation6Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation3Output, error) { - req, out := c.InputService16TestCaseOperation3Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService16TestCaseOperation4 = "OperationName" - -// InputService16TestCaseOperation4Request generates a "aws/request.Request" representing the -// client's request for the InputService16TestCaseOperation4 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService16TestCaseOperation4 for more information on using the InputService16TestCaseOperation4 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService16TestCaseOperation4Request method. -// req, resp := client.InputService16TestCaseOperation4Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService16ProtocolTest) InputService16TestCaseOperation4Request(input *InputService16TestShapeInputService16TestCaseOperation6Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation4, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService16TestShapeInputService16TestCaseOperation6Input{} - } - - output = &InputService16TestShapeInputService16TestCaseOperation4Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService16TestCaseOperation4 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService16TestCaseOperation4 for usage and error information. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation4(input *InputService16TestShapeInputService16TestCaseOperation6Input) (*InputService16TestShapeInputService16TestCaseOperation4Output, error) { - req, out := c.InputService16TestCaseOperation4Request(input) - return out, req.Send() -} - -// InputService16TestCaseOperation4WithContext is the same as InputService16TestCaseOperation4 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService16TestCaseOperation4 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation4WithContext(ctx aws.Context, input *InputService16TestShapeInputService16TestCaseOperation6Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation4Output, error) { - req, out := c.InputService16TestCaseOperation4Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService16TestCaseOperation5 = "OperationName" - -// InputService16TestCaseOperation5Request generates a "aws/request.Request" representing the -// client's request for the InputService16TestCaseOperation5 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService16TestCaseOperation5 for more information on using the InputService16TestCaseOperation5 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService16TestCaseOperation5Request method. -// req, resp := client.InputService16TestCaseOperation5Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService16ProtocolTest) InputService16TestCaseOperation5Request(input *InputService16TestShapeInputService16TestCaseOperation6Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation5, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService16TestShapeInputService16TestCaseOperation6Input{} - } - - output = &InputService16TestShapeInputService16TestCaseOperation5Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService16TestCaseOperation5 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService16TestCaseOperation5 for usage and error information. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation5(input *InputService16TestShapeInputService16TestCaseOperation6Input) (*InputService16TestShapeInputService16TestCaseOperation5Output, error) { - req, out := c.InputService16TestCaseOperation5Request(input) - return out, req.Send() -} - -// InputService16TestCaseOperation5WithContext is the same as InputService16TestCaseOperation5 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService16TestCaseOperation5 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation5WithContext(ctx aws.Context, input *InputService16TestShapeInputService16TestCaseOperation6Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation5Output, error) { - req, out := c.InputService16TestCaseOperation5Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService16TestCaseOperation6 = "OperationName" - -// InputService16TestCaseOperation6Request generates a "aws/request.Request" representing the -// client's request for the InputService16TestCaseOperation6 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService16TestCaseOperation6 for more information on using the InputService16TestCaseOperation6 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService16TestCaseOperation6Request method. -// req, resp := client.InputService16TestCaseOperation6Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService16ProtocolTest) InputService16TestCaseOperation6Request(input *InputService16TestShapeInputService16TestCaseOperation6Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation6, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService16TestShapeInputService16TestCaseOperation6Input{} - } - - output = &InputService16TestShapeInputService16TestCaseOperation6Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService16TestCaseOperation6 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService16TestCaseOperation6 for usage and error information. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation6(input *InputService16TestShapeInputService16TestCaseOperation6Input) (*InputService16TestShapeInputService16TestCaseOperation6Output, error) { - req, out := c.InputService16TestCaseOperation6Request(input) - return out, req.Send() -} - -// InputService16TestCaseOperation6WithContext is the same as InputService16TestCaseOperation6 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService16TestCaseOperation6 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation6WithContext(ctx aws.Context, input *InputService16TestShapeInputService16TestCaseOperation6Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation6Output, error) { - req, out := c.InputService16TestCaseOperation6Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService16TestShapeInputService16TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeInputService16TestCaseOperation6Input struct { - _ struct{} `type:"structure"` - - RecursiveStruct *InputService16TestShapeRecursiveStructType `type:"structure"` -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService16TestShapeInputService16TestCaseOperation6Input) SetRecursiveStruct(v *InputService16TestShapeRecursiveStructType) *InputService16TestShapeInputService16TestCaseOperation6Input { - s.RecursiveStruct = v - return s -} - -type InputService16TestShapeInputService16TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService16TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService16TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService16TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService16TestShapeRecursiveStructType `type:"structure"` -} - -// SetNoRecurse sets the NoRecurse field's value. -func (s *InputService16TestShapeRecursiveStructType) SetNoRecurse(v string) *InputService16TestShapeRecursiveStructType { - s.NoRecurse = &v - return s -} - -// SetRecursiveList sets the RecursiveList field's value. -func (s *InputService16TestShapeRecursiveStructType) SetRecursiveList(v []*InputService16TestShapeRecursiveStructType) *InputService16TestShapeRecursiveStructType { - s.RecursiveList = v - return s -} - -// SetRecursiveMap sets the RecursiveMap field's value. -func (s *InputService16TestShapeRecursiveStructType) SetRecursiveMap(v map[string]*InputService16TestShapeRecursiveStructType) *InputService16TestShapeRecursiveStructType { - s.RecursiveMap = v - return s -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService16TestShapeRecursiveStructType) SetRecursiveStruct(v *InputService16TestShapeRecursiveStructType) *InputService16TestShapeRecursiveStructType { - s.RecursiveStruct = v - return s -} - -// InputService17ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService17ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService17ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService17ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService17ProtocolTest client from just a session. -// svc := inputservice17protocoltest.New(mySession) -// -// // Create a InputService17ProtocolTest client with additional configuration -// svc := inputservice17protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService17ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService17ProtocolTest { - c := p.ClientConfig("inputservice17protocoltest", cfgs...) - return newInputService17ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService17ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService17ProtocolTest { - svc := &InputService17ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice17protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService17ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService17ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService17TestCaseOperation1 = "OperationName" - -// InputService17TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService17TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService17TestCaseOperation1 for more information on using the InputService17TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService17TestCaseOperation1Request method. -// req, resp := client.InputService17TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService17ProtocolTest) InputService17TestCaseOperation1Request(input *InputService17TestShapeInputService17TestCaseOperation2Input) (req *request.Request, output *InputService17TestShapeInputService17TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService17TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService17TestShapeInputService17TestCaseOperation2Input{} - } - - output = &InputService17TestShapeInputService17TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService17TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService17TestCaseOperation1 for usage and error information. -func (c *InputService17ProtocolTest) InputService17TestCaseOperation1(input *InputService17TestShapeInputService17TestCaseOperation2Input) (*InputService17TestShapeInputService17TestCaseOperation1Output, error) { - req, out := c.InputService17TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService17TestCaseOperation1WithContext is the same as InputService17TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService17TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService17ProtocolTest) InputService17TestCaseOperation1WithContext(ctx aws.Context, input *InputService17TestShapeInputService17TestCaseOperation2Input, opts ...request.Option) (*InputService17TestShapeInputService17TestCaseOperation1Output, error) { - req, out := c.InputService17TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService17TestCaseOperation2 = "OperationName" - -// InputService17TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService17TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService17TestCaseOperation2 for more information on using the InputService17TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService17TestCaseOperation2Request method. -// req, resp := client.InputService17TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService17ProtocolTest) InputService17TestCaseOperation2Request(input *InputService17TestShapeInputService17TestCaseOperation2Input) (req *request.Request, output *InputService17TestShapeInputService17TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService17TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService17TestShapeInputService17TestCaseOperation2Input{} - } - - output = &InputService17TestShapeInputService17TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService17TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService17TestCaseOperation2 for usage and error information. -func (c *InputService17ProtocolTest) InputService17TestCaseOperation2(input *InputService17TestShapeInputService17TestCaseOperation2Input) (*InputService17TestShapeInputService17TestCaseOperation2Output, error) { - req, out := c.InputService17TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService17TestCaseOperation2WithContext is the same as InputService17TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService17TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService17ProtocolTest) InputService17TestCaseOperation2WithContext(ctx aws.Context, input *InputService17TestShapeInputService17TestCaseOperation2Input, opts ...request.Option) (*InputService17TestShapeInputService17TestCaseOperation2Output, error) { - req, out := c.InputService17TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService17TestShapeInputService17TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService17TestShapeInputService17TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `type:"timestamp" timestampFormat:"unix"` - - TimeArgInHeader *time.Time `location:"header" locationName:"x-amz-timearg" type:"timestamp" timestampFormat:"rfc822"` -} - -// SetTimeArg sets the TimeArg field's value. -func (s *InputService17TestShapeInputService17TestCaseOperation2Input) SetTimeArg(v time.Time) *InputService17TestShapeInputService17TestCaseOperation2Input { - s.TimeArg = &v - return s -} - -// SetTimeArgInHeader sets the TimeArgInHeader field's value. -func (s *InputService17TestShapeInputService17TestCaseOperation2Input) SetTimeArgInHeader(v time.Time) *InputService17TestShapeInputService17TestCaseOperation2Input { - s.TimeArgInHeader = &v - return s -} - -type InputService17TestShapeInputService17TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService18ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService18ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService18ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService18ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService18ProtocolTest client from just a session. -// svc := inputservice18protocoltest.New(mySession) -// -// // Create a InputService18ProtocolTest client with additional configuration -// svc := inputservice18protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService18ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService18ProtocolTest { - c := p.ClientConfig("inputservice18protocoltest", cfgs...) - return newInputService18ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService18ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService18ProtocolTest { - svc := &InputService18ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice18protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService18ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService18ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService18TestCaseOperation1 = "OperationName" - -// InputService18TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService18TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService18TestCaseOperation1 for more information on using the InputService18TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService18TestCaseOperation1Request method. -// req, resp := client.InputService18TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService18ProtocolTest) InputService18TestCaseOperation1Request(input *InputService18TestShapeInputService18TestCaseOperation1Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService18TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService18TestShapeInputService18TestCaseOperation1Input{} - } - - output = &InputService18TestShapeInputService18TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService18TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService18TestCaseOperation1 for usage and error information. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation1(input *InputService18TestShapeInputService18TestCaseOperation1Input) (*InputService18TestShapeInputService18TestCaseOperation1Output, error) { - req, out := c.InputService18TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService18TestCaseOperation1WithContext is the same as InputService18TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService18TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation1WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation1Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation1Output, error) { - req, out := c.InputService18TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService18TestShapeInputService18TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArg *time.Time `locationName:"timestamp_location" type:"timestamp" timestampFormat:"unix"` -} - -// SetTimeArg sets the TimeArg field's value. -func (s *InputService18TestShapeInputService18TestCaseOperation1Input) SetTimeArg(v time.Time) *InputService18TestShapeInputService18TestCaseOperation1Input { - s.TimeArg = &v - return s -} - -type InputService18TestShapeInputService18TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService19ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService19ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService19ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService19ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService19ProtocolTest client from just a session. -// svc := inputservice19protocoltest.New(mySession) -// -// // Create a InputService19ProtocolTest client with additional configuration -// svc := inputservice19protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService19ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService19ProtocolTest { - c := p.ClientConfig("inputservice19protocoltest", cfgs...) - return newInputService19ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService19ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService19ProtocolTest { - svc := &InputService19ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice19protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService19ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService19ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService19TestCaseOperation1 = "OperationName" - -// InputService19TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService19TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService19TestCaseOperation1 for more information on using the InputService19TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService19TestCaseOperation1Request method. -// req, resp := client.InputService19TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService19ProtocolTest) InputService19TestCaseOperation1Request(input *InputService19TestShapeInputService19TestCaseOperation1Input) (req *request.Request, output *InputService19TestShapeInputService19TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService19TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService19TestShapeInputService19TestCaseOperation1Input{} - } - - output = &InputService19TestShapeInputService19TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService19TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService19TestCaseOperation1 for usage and error information. -func (c *InputService19ProtocolTest) InputService19TestCaseOperation1(input *InputService19TestShapeInputService19TestCaseOperation1Input) (*InputService19TestShapeInputService19TestCaseOperation1Output, error) { - req, out := c.InputService19TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService19TestCaseOperation1WithContext is the same as InputService19TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService19TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService19ProtocolTest) InputService19TestCaseOperation1WithContext(ctx aws.Context, input *InputService19TestShapeInputService19TestCaseOperation1Input, opts ...request.Option) (*InputService19TestShapeInputService19TestCaseOperation1Output, error) { - req, out := c.InputService19TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService19TestShapeInputService19TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *string `locationName:"foo" type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService19TestShapeInputService19TestCaseOperation1Input) SetFoo(v string) *InputService19TestShapeInputService19TestCaseOperation1Input { - s.Foo = &v - return s -} - -type InputService19TestShapeInputService19TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService20ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService20ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService20ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService20ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService20ProtocolTest client from just a session. -// svc := inputservice20protocoltest.New(mySession) -// -// // Create a InputService20ProtocolTest client with additional configuration -// svc := inputservice20protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService20ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService20ProtocolTest { - c := p.ClientConfig("inputservice20protocoltest", cfgs...) - return newInputService20ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService20ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService20ProtocolTest { - svc := &InputService20ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice20protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService20ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService20ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService20TestCaseOperation1 = "OperationName" - -// InputService20TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService20TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService20TestCaseOperation1 for more information on using the InputService20TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService20TestCaseOperation1Request method. -// req, resp := client.InputService20TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService20ProtocolTest) InputService20TestCaseOperation1Request(input *InputService20TestShapeInputService20TestCaseOperation2Input) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputService20TestCaseOperation2Input{} - } - - output = &InputService20TestShapeInputService20TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService20TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService20TestCaseOperation1 for usage and error information. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation1(input *InputService20TestShapeInputService20TestCaseOperation2Input) (*InputService20TestShapeInputService20TestCaseOperation1Output, error) { - req, out := c.InputService20TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService20TestCaseOperation1WithContext is the same as InputService20TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService20TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation1WithContext(ctx aws.Context, input *InputService20TestShapeInputService20TestCaseOperation2Input, opts ...request.Option) (*InputService20TestShapeInputService20TestCaseOperation1Output, error) { - req, out := c.InputService20TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService20TestCaseOperation2 = "OperationName" - -// InputService20TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService20TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService20TestCaseOperation2 for more information on using the InputService20TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService20TestCaseOperation2Request method. -// req, resp := client.InputService20TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService20ProtocolTest) InputService20TestCaseOperation2Request(input *InputService20TestShapeInputService20TestCaseOperation2Input) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService20TestShapeInputService20TestCaseOperation2Input{} - } - - output = &InputService20TestShapeInputService20TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService20TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService20TestCaseOperation2 for usage and error information. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation2(input *InputService20TestShapeInputService20TestCaseOperation2Input) (*InputService20TestShapeInputService20TestCaseOperation2Output, error) { - req, out := c.InputService20TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService20TestCaseOperation2WithContext is the same as InputService20TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService20TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService20ProtocolTest) InputService20TestCaseOperation2WithContext(ctx aws.Context, input *InputService20TestShapeInputService20TestCaseOperation2Input, opts ...request.Option) (*InputService20TestShapeInputService20TestCaseOperation2Output, error) { - req, out := c.InputService20TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService20TestShapeInputService20TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService20TestShapeInputService20TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - Token *string `type:"string" idempotencyToken:"true"` -} - -// SetToken sets the Token field's value. -func (s *InputService20TestShapeInputService20TestCaseOperation2Input) SetToken(v string) *InputService20TestShapeInputService20TestCaseOperation2Input { - s.Token = &v - return s -} - -type InputService20TestShapeInputService20TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService21ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService21ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService21ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService21ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a InputService21ProtocolTest client from just a session. -// svc := inputservice21protocoltest.New(mySession) -// -// // Create a InputService21ProtocolTest client with additional configuration -// svc := inputservice21protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService21ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService21ProtocolTest { - c := p.ClientConfig("inputservice21protocoltest", cfgs...) - return newInputService21ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService21ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService21ProtocolTest { - svc := &InputService21ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice21protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService21ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService21ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService21TestCaseOperation1 = "OperationName" - -// InputService21TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService21TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService21TestCaseOperation1 for more information on using the InputService21TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService21TestCaseOperation1Request method. -// req, resp := client.InputService21TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService21ProtocolTest) InputService21TestCaseOperation1Request(input *InputService21TestShapeInputService21TestCaseOperation2Input) (req *request.Request, output *InputService21TestShapeInputService21TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService21TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService21TestShapeInputService21TestCaseOperation2Input{} - } - - output = &InputService21TestShapeInputService21TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService21TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService21TestCaseOperation1 for usage and error information. -func (c *InputService21ProtocolTest) InputService21TestCaseOperation1(input *InputService21TestShapeInputService21TestCaseOperation2Input) (*InputService21TestShapeInputService21TestCaseOperation1Output, error) { - req, out := c.InputService21TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService21TestCaseOperation1WithContext is the same as InputService21TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService21TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService21ProtocolTest) InputService21TestCaseOperation1WithContext(ctx aws.Context, input *InputService21TestShapeInputService21TestCaseOperation2Input, opts ...request.Option) (*InputService21TestShapeInputService21TestCaseOperation1Output, error) { - req, out := c.InputService21TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService21TestCaseOperation2 = "OperationName" - -// InputService21TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService21TestCaseOperation2 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See InputService21TestCaseOperation2 for more information on using the InputService21TestCaseOperation2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the InputService21TestCaseOperation2Request method. -// req, resp := client.InputService21TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService21ProtocolTest) InputService21TestCaseOperation2Request(input *InputService21TestShapeInputService21TestCaseOperation2Input) (req *request.Request, output *InputService21TestShapeInputService21TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService21TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService21TestShapeInputService21TestCaseOperation2Input{} - } - - output = &InputService21TestShapeInputService21TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService21TestCaseOperation2 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation InputService21TestCaseOperation2 for usage and error information. -func (c *InputService21ProtocolTest) InputService21TestCaseOperation2(input *InputService21TestShapeInputService21TestCaseOperation2Input) (*InputService21TestShapeInputService21TestCaseOperation2Output, error) { - req, out := c.InputService21TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService21TestCaseOperation2WithContext is the same as InputService21TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService21TestCaseOperation2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *InputService21ProtocolTest) InputService21TestCaseOperation2WithContext(ctx aws.Context, input *InputService21TestShapeInputService21TestCaseOperation2Input, opts ...request.Option) (*InputService21TestShapeInputService21TestCaseOperation2Output, error) { - req, out := c.InputService21TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService21TestShapeInputService21TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService21TestShapeInputService21TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - Attr aws.JSONValue `location:"header" locationName:"X-Amz-Foo" type:"jsonvalue"` -} - -// SetAttr sets the Attr field's value. -func (s *InputService21TestShapeInputService21TestCaseOperation2Input) SetAttr(v aws.JSONValue) *InputService21TestShapeInputService21TestCaseOperation2Input { - s.Attr = v - return s -} - -type InputService21TestShapeInputService21TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestNoParametersCase1(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - req, _ := svc.InputService1TestCaseOperation1Request(nil) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobs", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestURIParameterOnlyWithNoLocationNameCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestURIParameterOnlyWithLocationNameCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation1Input{ - Foo: aws.String("bar"), - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/bar", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestQuerystringListOfStringsCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ - Items: []*string{ - aws.String("value1"), - aws.String("value2"), - }, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/path?item=value1&item=value2", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestStringToStringMapsInQuerystringCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation1Input{ - PipelineId: aws.String("foo"), - QueryDoc: map[string]*string{ - "bar": aws.String("baz"), - "fizz": aws.String("buzz"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?bar=baz&fizz=buzz", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestStringToStringListMapsInQuerystringCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - PipelineId: aws.String("id"), - QueryDoc: map[string][]*string{ - "fizz": { - aws.String("buzz"), - aws.String("pop"), - }, - "foo": { - aws.String("bar"), - aws.String("baz"), - }, - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/id?foo=bar&foo=baz&fizz=buzz&fizz=pop", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestBooleanInQuerystringCase1(t *testing.T) { - svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService7TestShapeInputService7TestCaseOperation2Input{ - BoolQuery: aws.Bool(true), - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/path?bool-query=true", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestBooleanInQuerystringCase2(t *testing.T) { - svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService7TestShapeInputService7TestCaseOperation2Input{ - BoolQuery: aws.Bool(false), - } - req, _ := svc.InputService7TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/path?bool-query=false", r.URL.String()) - - // assert headers - -} - -func TestInputService8ProtocolTestURIParameterAndQuerystringParamsCase1(t *testing.T) { - svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ - Ascending: aws.String("true"), - PageToken: aws.String("bar"), - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestURIParameterQuerystringParamsAndJSONBodyCase1(t *testing.T) { - svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService9TestShapeInputService9TestCaseOperation1Input{ - Ascending: aws.String("true"), - Config: &InputService9TestShapeStructType{ - A: aws.String("one"), - B: aws.String("two"), - }, - PageToken: aws.String("bar"), - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Config":{"A":"one","B":"two"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBodyCase1(t *testing.T) { - svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputService10TestCaseOperation1Input{ - Ascending: aws.String("true"), - Checksum: aws.String("12345"), - Config: &InputService10TestShapeStructType{ - A: aws.String("one"), - B: aws.String("two"), - }, - PageToken: aws.String("bar"), - PipelineId: aws.String("foo"), - } - req, _ := svc.InputService10TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Config":{"A":"one","B":"two"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) - - // assert headers - if e, a := "12345", r.Header.Get("x-amz-checksum"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService11ProtocolTestStreamingPayloadCase1(t *testing.T) { - svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService11TestShapeInputService11TestCaseOperation1Input{ - Body: bytes.NewReader([]byte("contents")), - Checksum: aws.String("foo"), - VaultName: aws.String("name"), - } - req, _ := svc.InputService11TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - if e, a := "contents", util.Trim(string(body)); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/vaults/name/archives", r.URL.String()) - - // assert headers - if e, a := "foo", r.Header.Get("x-amz-sha256-tree-hash"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService12ProtocolTestSerializeBlobsInBodyCase1(t *testing.T) { - svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService12TestShapeInputService12TestCaseOperation1Input{ - Bar: []byte("Blob param"), - Foo: aws.String("foo_name"), - } - req, _ := svc.InputService12TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Bar":"QmxvYiBwYXJhbQ=="}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/foo_name", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestBlobPayloadCase1(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation2Input{ - Foo: []byte("bar"), - } - req, _ := svc.InputService13TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - if e, a := "bar", util.Trim(string(body)); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestBlobPayloadCase2(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation2Input{} - req, _ := svc.InputService13TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestStructurePayloadCase1(t *testing.T) { - svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService14TestShapeInputService14TestCaseOperation2Input{ - Foo: &InputService14TestShapeFooShape{ - Baz: aws.String("bar"), - }, - } - req, _ := svc.InputService14TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"baz":"bar"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestStructurePayloadCase2(t *testing.T) { - svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService14TestShapeInputService14TestCaseOperation2Input{} - req, _ := svc.InputService14TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService15ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { - svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService15TestShapeInputService15TestCaseOperation2Input{} - req, _ := svc.InputService15TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService15ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) { - svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService15TestShapeInputService15TestCaseOperation2Input{ - Foo: aws.String(""), - } - req, _ := svc.InputService15TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/path?abc=mno¶m-name=", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestRecursiveShapesCase1(t *testing.T) { - svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService16TestShapeInputService16TestCaseOperation6Input{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService16TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"NoRecurse":"foo"}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestRecursiveShapesCase2(t *testing.T) { - svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService16TestShapeInputService16TestCaseOperation6Input{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService16TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestRecursiveShapesCase3(t *testing.T) { - svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService16TestShapeInputService16TestCaseOperation6Input{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService16TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestRecursiveShapesCase4(t *testing.T) { - svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService16TestShapeInputService16TestCaseOperation6Input{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - RecursiveList: []*InputService16TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService16TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"NoRecurse":"bar"}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestRecursiveShapesCase5(t *testing.T) { - svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService16TestShapeInputService16TestCaseOperation6Input{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - RecursiveList: []*InputService16TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService16TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"RecursiveStruct":{"NoRecurse":"bar"}}]}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestRecursiveShapesCase6(t *testing.T) { - svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService16TestShapeInputService16TestCaseOperation6Input{ - RecursiveStruct: &InputService16TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService16TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService16TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService17ProtocolTestTimestampValuesCase1(t *testing.T) { - svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService17TestShapeInputService17TestCaseOperation2Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService17TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"TimeArg":1422172800}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService17ProtocolTestTimestampValuesCase2(t *testing.T) { - svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService17TestShapeInputService17TestCaseOperation2Input{ - TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService17TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - if e, a := "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService18ProtocolTestNamedLocationsInJSONBodyCase1(t *testing.T) { - svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService18TestShapeInputService18TestCaseOperation1Input{ - TimeArg: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService18TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"timestamp_location":1422172800}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService19ProtocolTestStringPayloadCase1(t *testing.T) { - svc := NewInputService19ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService19TestShapeInputService19TestCaseOperation1Input{ - Foo: aws.String("bar"), - } - req, _ := svc.InputService19TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - if e, a := "bar", util.Trim(string(body)); e != a { - t.Errorf("expect %v, got %v", e, a) - } - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - svc := NewInputService20ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService20TestShapeInputService20TestCaseOperation2Input{ - Token: aws.String("abc123"), - } - req, _ := svc.InputService20TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Token":"abc123"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - svc := NewInputService20ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService20TestShapeInputService20TestCaseOperation2Input{} - req, _ := svc.InputService20TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert body - if r.Body == nil { - t.Errorf("expect body not to be nil") - } - body, _ := ioutil.ReadAll(r.Body) - awstesting.AssertJSON(t, `{"Token":"00000000-0000-4000-8000-000000000000"}`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService21ProtocolTestJSONValueTraitCase1(t *testing.T) { - svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService21TestShapeInputService21TestCaseOperation2Input{} - input.Attr = aws.JSONValue{"Foo": "Bar"} - req, _ := svc.InputService21TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - if e, a := "eyJGb28iOiJCYXIifQ==", r.Header.Get("X-Amz-Foo"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService21ProtocolTestJSONValueTraitCase2(t *testing.T) { - svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService21TestShapeInputService21TestCaseOperation2Input{} - req, _ := svc.InputService21TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restjson.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go deleted file mode 100644 index b1d5294a..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go +++ /dev/null @@ -1,92 +0,0 @@ -// Package restjson provides RESTful JSON serialization of AWS -// requests and responses. -package restjson - -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-json.json build_test.go -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-json.json unmarshal_test.go - -import ( - "encoding/json" - "io/ioutil" - "strings" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -// BuildHandler is a named request handler for building restjson protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.restjson.Build", Fn: Build} - -// UnmarshalHandler is a named request handler for unmarshaling restjson protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restjson.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling restjson protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalMeta", Fn: UnmarshalMeta} - -// UnmarshalErrorHandler is a named request handler for unmarshaling restjson protocol request errors -var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalError", Fn: UnmarshalError} - -// Build builds a request for the REST JSON protocol. -func Build(r *request.Request) { - rest.Build(r) - - if t := rest.PayloadType(r.Params); t == "structure" || t == "" { - jsonrpc.Build(r) - } -} - -// Unmarshal unmarshals a response body for the REST JSON protocol. -func Unmarshal(r *request.Request) { - if t := rest.PayloadType(r.Data); t == "structure" || t == "" { - jsonrpc.Unmarshal(r) - } else { - rest.Unmarshal(r) - } -} - -// UnmarshalMeta unmarshals response headers for the REST JSON protocol. -func UnmarshalMeta(r *request.Request) { - rest.UnmarshalMeta(r) -} - -// UnmarshalError unmarshals a response error for the REST JSON protocol. -func UnmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - code := r.HTTPResponse.Header.Get("X-Amzn-Errortype") - bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", "failed reading REST JSON error response", err) - return - } - if len(bodyBytes) == 0 { - r.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", r.HTTPResponse.Status, nil), - r.HTTPResponse.StatusCode, - "", - ) - return - } - var jsonErr jsonErrorResponse - if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { - r.Error = awserr.New("SerializationError", "failed decoding REST JSON error response", err) - return - } - - if code == "" { - code = jsonErr.Code - } - - code = strings.SplitN(code, ":", 2)[0] - r.Error = awserr.NewRequestFailure( - awserr.New(code, jsonErr.Message, nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) -} - -type jsonErrorResponse struct { - Code string `json:"code"` - Message string `json:"message"` -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/unmarshal_test.go deleted file mode 100644 index 134a1ae3..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/unmarshal_test.go +++ /dev/null @@ -1,2309 +0,0 @@ -package restjson_test - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/awstesting" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/restjson" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" - "github.com/aws/aws-sdk-go/private/util" -) - -var _ bytes.Buffer // always import bytes -var _ http.Request -var _ json.Marshaler -var _ time.Time -var _ xmlutil.XMLNode -var _ xml.Attr -var _ = ioutil.Discard -var _ = util.Trim("") -var _ = url.Values{} -var _ = io.EOF -var _ = aws.String -var _ = fmt.Println -var _ = reflect.Value{} - -func init() { - protocol.RandReader = &awstesting.ZeroReader{} -} - -// OutputService1ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService1ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService1ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService1ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService1ProtocolTest client from just a session. -// svc := outputservice1protocoltest.New(mySession) -// -// // Create a OutputService1ProtocolTest client with additional configuration -// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest { - c := p.ClientConfig("outputservice1protocoltest", cfgs...) - return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService1ProtocolTest { - svc := &OutputService1ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice1protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService1TestCaseOperation1 = "OperationName" - -// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService1TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService1TestCaseOperation1 for more information on using the OutputService1TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService1TestCaseOperation1Request method. -// req, resp := client.OutputService1TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService1TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService1TestCaseOperation1 for usage and error information. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService1TestCaseOperation1WithContext is the same as OutputService1TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService1TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation1Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - ImaHeader *string `location:"header" type:"string"` - - ImaHeaderLocation *string `location:"header" locationName:"X-Foo" type:"string"` - - Long *int64 `type:"long"` - - Num *int64 `type:"integer"` - - Status *int64 `location:"statusCode" type:"integer"` - - Str *string `type:"string"` - - TrueBool *bool `type:"boolean"` -} - -// SetChar sets the Char field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetChar(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Char = &v - return s -} - -// SetDouble sets the Double field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetDouble(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Double = &v - return s -} - -// SetFalseBool sets the FalseBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFalseBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.FalseBool = &v - return s -} - -// SetFloat sets the Float field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetFloat(v float64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Float = &v - return s -} - -// SetImaHeader sets the ImaHeader field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetImaHeader(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.ImaHeader = &v - return s -} - -// SetImaHeaderLocation sets the ImaHeaderLocation field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetImaHeaderLocation(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.ImaHeaderLocation = &v - return s -} - -// SetLong sets the Long field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetLong(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Long = &v - return s -} - -// SetNum sets the Num field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetNum(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Num = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetStatus(v int64) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Status = &v - return s -} - -// SetStr sets the Str field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetStr(v string) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.Str = &v - return s -} - -// SetTrueBool sets the TrueBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation1Output) SetTrueBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation1Output { - s.TrueBool = &v - return s -} - -// OutputService2ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService2ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService2ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService2ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService2ProtocolTest client from just a session. -// svc := outputservice2protocoltest.New(mySession) -// -// // Create a OutputService2ProtocolTest client with additional configuration -// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest { - c := p.ClientConfig("outputservice2protocoltest", cfgs...) - return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService2ProtocolTest { - svc := &OutputService2ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice2protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService2TestCaseOperation1 = "OperationName" - -// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService2TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService2TestCaseOperation1 for more information on using the OutputService2TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService2TestCaseOperation1Request method. -// req, resp := client.OutputService2TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService2TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService2TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService2TestCaseOperation1 for usage and error information. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService2TestCaseOperation1WithContext is the same as OutputService2TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService2TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1WithContext(ctx aws.Context, input *OutputService2TestShapeOutputService2TestCaseOperation1Input, opts ...request.Option) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService2TestShapeBlobContainer struct { - _ struct{} `type:"structure"` - - // Foo is automatically base64 encoded/decoded by the SDK. - Foo []byte `locationName:"foo" type:"blob"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService2TestShapeBlobContainer) SetFoo(v []byte) *OutputService2TestShapeBlobContainer { - s.Foo = v - return s -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - // BlobMember is automatically base64 encoded/decoded by the SDK. - BlobMember []byte `type:"blob"` - - StructMember *OutputService2TestShapeBlobContainer `type:"structure"` -} - -// SetBlobMember sets the BlobMember field's value. -func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetBlobMember(v []byte) *OutputService2TestShapeOutputService2TestCaseOperation1Output { - s.BlobMember = v - return s -} - -// SetStructMember sets the StructMember field's value. -func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetStructMember(v *OutputService2TestShapeBlobContainer) *OutputService2TestShapeOutputService2TestCaseOperation1Output { - s.StructMember = v - return s -} - -// OutputService3ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService3ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService3ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService3ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService3ProtocolTest client from just a session. -// svc := outputservice3protocoltest.New(mySession) -// -// // Create a OutputService3ProtocolTest client with additional configuration -// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest { - c := p.ClientConfig("outputservice3protocoltest", cfgs...) - return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService3ProtocolTest { - svc := &OutputService3ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice3protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService3TestCaseOperation1 = "OperationName" - -// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService3TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService3TestCaseOperation1 for more information on using the OutputService3TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService3TestCaseOperation1Request method. -// req, resp := client.OutputService3TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService3TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService3TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService3TestCaseOperation1 for usage and error information. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService3TestCaseOperation1WithContext is the same as OutputService3TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService3TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1WithContext(ctx aws.Context, input *OutputService3TestShapeOutputService3TestCaseOperation1Input, opts ...request.Option) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StructMember *OutputService3TestShapeTimeContainer `type:"structure"` - - TimeMember *time.Time `type:"timestamp" timestampFormat:"unix"` -} - -// SetStructMember sets the StructMember field's value. -func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetStructMember(v *OutputService3TestShapeTimeContainer) *OutputService3TestShapeOutputService3TestCaseOperation1Output { - s.StructMember = v - return s -} - -// SetTimeMember sets the TimeMember field's value. -func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetTimeMember(v time.Time) *OutputService3TestShapeOutputService3TestCaseOperation1Output { - s.TimeMember = &v - return s -} - -type OutputService3TestShapeTimeContainer struct { - _ struct{} `type:"structure"` - - Foo *time.Time `locationName:"foo" type:"timestamp" timestampFormat:"unix"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService3TestShapeTimeContainer) SetFoo(v time.Time) *OutputService3TestShapeTimeContainer { - s.Foo = &v - return s -} - -// OutputService4ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService4ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService4ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService4ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService4ProtocolTest client from just a session. -// svc := outputservice4protocoltest.New(mySession) -// -// // Create a OutputService4ProtocolTest client with additional configuration -// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest { - c := p.ClientConfig("outputservice4protocoltest", cfgs...) - return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService4ProtocolTest { - svc := &OutputService4ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice4protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService4TestCaseOperation1 = "OperationName" - -// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService4TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService4TestCaseOperation1 for more information on using the OutputService4TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService4TestCaseOperation1Request method. -// req, resp := client.OutputService4TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService4TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService4TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService4TestCaseOperation1 for usage and error information. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService4TestCaseOperation1WithContext is the same as OutputService4TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService4TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1WithContext(ctx aws.Context, input *OutputService4TestShapeOutputService4TestCaseOperation1Input, opts ...request.Option) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*string `type:"list"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService4TestShapeOutputService4TestCaseOperation1Output) SetListMember(v []*string) *OutputService4TestShapeOutputService4TestCaseOperation1Output { - s.ListMember = v - return s -} - -// OutputService5ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService5ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService5ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService5ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService5ProtocolTest client from just a session. -// svc := outputservice5protocoltest.New(mySession) -// -// // Create a OutputService5ProtocolTest client with additional configuration -// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest { - c := p.ClientConfig("outputservice5protocoltest", cfgs...) - return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService5ProtocolTest { - svc := &OutputService5ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice5protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService5TestCaseOperation1 = "OperationName" - -// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService5TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService5TestCaseOperation1 for more information on using the OutputService5TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService5TestCaseOperation1Request method. -// req, resp := client.OutputService5TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService5TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService5TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService5TestCaseOperation1 for usage and error information. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService5TestCaseOperation1WithContext is the same as OutputService5TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService5TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1WithContext(ctx aws.Context, input *OutputService5TestShapeOutputService5TestCaseOperation1Input, opts ...request.Option) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListMember []*OutputService5TestShapeSingleStruct `type:"list"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService5TestShapeOutputService5TestCaseOperation1Output) SetListMember(v []*OutputService5TestShapeSingleStruct) *OutputService5TestShapeOutputService5TestCaseOperation1Output { - s.ListMember = v - return s -} - -type OutputService5TestShapeSingleStruct struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService5TestShapeSingleStruct) SetFoo(v string) *OutputService5TestShapeSingleStruct { - s.Foo = &v - return s -} - -// OutputService6ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService6ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService6ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService6ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService6ProtocolTest client from just a session. -// svc := outputservice6protocoltest.New(mySession) -// -// // Create a OutputService6ProtocolTest client with additional configuration -// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest { - c := p.ClientConfig("outputservice6protocoltest", cfgs...) - return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService6ProtocolTest { - svc := &OutputService6ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice6protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService6TestCaseOperation1 = "OperationName" - -// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService6TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService6TestCaseOperation1 for more information on using the OutputService6TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService6TestCaseOperation1Request method. -// req, resp := client.OutputService6TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService6TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService6TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService6TestCaseOperation1 for usage and error information. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService6TestCaseOperation1WithContext is the same as OutputService6TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService6TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1WithContext(ctx aws.Context, input *OutputService6TestShapeOutputService6TestCaseOperation1Input, opts ...request.Option) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - MapMember map[string][]*int64 `type:"map"` -} - -// SetMapMember sets the MapMember field's value. -func (s *OutputService6TestShapeOutputService6TestCaseOperation1Output) SetMapMember(v map[string][]*int64) *OutputService6TestShapeOutputService6TestCaseOperation1Output { - s.MapMember = v - return s -} - -// OutputService7ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService7ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService7ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService7ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService7ProtocolTest client from just a session. -// svc := outputservice7protocoltest.New(mySession) -// -// // Create a OutputService7ProtocolTest client with additional configuration -// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest { - c := p.ClientConfig("outputservice7protocoltest", cfgs...) - return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService7ProtocolTest { - svc := &OutputService7ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice7protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService7TestCaseOperation1 = "OperationName" - -// OutputService7TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService7TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService7TestCaseOperation1 for more information on using the OutputService7TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService7TestCaseOperation1Request method. -// req, resp := client.OutputService7TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService7TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService7TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService7TestCaseOperation1 for usage and error information. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService7TestCaseOperation1WithContext is the same as OutputService7TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService7TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1WithContext(ctx aws.Context, input *OutputService7TestShapeOutputService7TestCaseOperation1Input, opts ...request.Option) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - MapMember map[string]*time.Time `type:"map"` -} - -// SetMapMember sets the MapMember field's value. -func (s *OutputService7TestShapeOutputService7TestCaseOperation1Output) SetMapMember(v map[string]*time.Time) *OutputService7TestShapeOutputService7TestCaseOperation1Output { - s.MapMember = v - return s -} - -// OutputService8ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService8ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService8ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService8ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService8ProtocolTest client from just a session. -// svc := outputservice8protocoltest.New(mySession) -// -// // Create a OutputService8ProtocolTest client with additional configuration -// svc := outputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService8ProtocolTest { - c := p.ClientConfig("outputservice8protocoltest", cfgs...) - return newOutputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService8ProtocolTest { - svc := &OutputService8ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice8protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService8TestCaseOperation1 = "OperationName" - -// OutputService8TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService8TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService8TestCaseOperation1 for more information on using the OutputService8TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService8TestCaseOperation1Request method. -// req, resp := client.OutputService8TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService8TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService8TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService8TestCaseOperation1 for usage and error information. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService8TestCaseOperation1WithContext is the same as OutputService8TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService8TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1WithContext(ctx aws.Context, input *OutputService8TestShapeOutputService8TestCaseOperation1Input, opts ...request.Option) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - StrType *string `type:"string"` -} - -// SetStrType sets the StrType field's value. -func (s *OutputService8TestShapeOutputService8TestCaseOperation1Output) SetStrType(v string) *OutputService8TestShapeOutputService8TestCaseOperation1Output { - s.StrType = &v - return s -} - -// OutputService9ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService9ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService9ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService9ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService9ProtocolTest client from just a session. -// svc := outputservice9protocoltest.New(mySession) -// -// // Create a OutputService9ProtocolTest client with additional configuration -// svc := outputservice9protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService9ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService9ProtocolTest { - c := p.ClientConfig("outputservice9protocoltest", cfgs...) - return newOutputService9ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService9ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService9ProtocolTest { - svc := &OutputService9ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice9protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService9TestCaseOperation1 = "OperationName" - -// OutputService9TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService9TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService9TestCaseOperation1 for more information on using the OutputService9TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService9TestCaseOperation1Request method. -// req, resp := client.OutputService9TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService9TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService9TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService9TestCaseOperation1 for usage and error information. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService9TestCaseOperation1WithContext is the same as OutputService9TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService9TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1WithContext(ctx aws.Context, input *OutputService9TestShapeOutputService9TestCaseOperation1Input, opts ...request.Option) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - AllHeaders map[string]*string `location:"headers" type:"map"` - - PrefixedHeaders map[string]*string `location:"headers" locationName:"X-" type:"map"` -} - -// SetAllHeaders sets the AllHeaders field's value. -func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetAllHeaders(v map[string]*string) *OutputService9TestShapeOutputService9TestCaseOperation1Output { - s.AllHeaders = v - return s -} - -// SetPrefixedHeaders sets the PrefixedHeaders field's value. -func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetPrefixedHeaders(v map[string]*string) *OutputService9TestShapeOutputService9TestCaseOperation1Output { - s.PrefixedHeaders = v - return s -} - -// OutputService10ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService10ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService10ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService10ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService10ProtocolTest client from just a session. -// svc := outputservice10protocoltest.New(mySession) -// -// // Create a OutputService10ProtocolTest client with additional configuration -// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest { - c := p.ClientConfig("outputservice10protocoltest", cfgs...) - return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService10ProtocolTest { - svc := &OutputService10ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice10protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService10TestCaseOperation1 = "OperationName" - -// OutputService10TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService10TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService10TestCaseOperation1 for more information on using the OutputService10TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService10TestCaseOperation1Request method. -// req, resp := client.OutputService10TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService10TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} - } - - output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService10TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService10TestCaseOperation1 for usage and error information. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService10TestCaseOperation1WithContext is the same as OutputService10TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService10TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1WithContext(ctx aws.Context, input *OutputService10TestShapeOutputService10TestCaseOperation1Input, opts ...request.Option) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService10TestShapeBodyStructure struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService10TestShapeBodyStructure) SetFoo(v string) *OutputService10TestShapeBodyStructure { - s.Foo = &v - return s -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService10TestShapeOutputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure" payload:"Data"` - - Data *OutputService10TestShapeBodyStructure `type:"structure"` - - Header *string `location:"header" locationName:"X-Foo" type:"string"` -} - -// SetData sets the Data field's value. -func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetData(v *OutputService10TestShapeBodyStructure) *OutputService10TestShapeOutputService10TestCaseOperation1Output { - s.Data = v - return s -} - -// SetHeader sets the Header field's value. -func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetHeader(v string) *OutputService10TestShapeOutputService10TestCaseOperation1Output { - s.Header = &v - return s -} - -// OutputService11ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService11ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService11ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService11ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService11ProtocolTest client from just a session. -// svc := outputservice11protocoltest.New(mySession) -// -// // Create a OutputService11ProtocolTest client with additional configuration -// svc := outputservice11protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService11ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService11ProtocolTest { - c := p.ClientConfig("outputservice11protocoltest", cfgs...) - return newOutputService11ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService11ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService11ProtocolTest { - svc := &OutputService11ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice11protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService11TestCaseOperation1 = "OperationName" - -// OutputService11TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService11TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService11TestCaseOperation1 for more information on using the OutputService11TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService11TestCaseOperation1Request method. -// req, resp := client.OutputService11TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService11TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} - } - - output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService11TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService11TestCaseOperation1 for usage and error information. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService11TestCaseOperation1WithContext is the same as OutputService11TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService11TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1WithContext(ctx aws.Context, input *OutputService11TestShapeOutputService11TestCaseOperation1Input, opts ...request.Option) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService11TestShapeOutputService11TestCaseOperation1Output struct { - _ struct{} `type:"structure" payload:"Stream"` - - Stream []byte `type:"blob"` -} - -// SetStream sets the Stream field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetStream(v []byte) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Stream = v - return s -} - -// OutputService12ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService12ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService12ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService12ProtocolTest client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a OutputService12ProtocolTest client from just a session. -// svc := outputservice12protocoltest.New(mySession) -// -// // Create a OutputService12ProtocolTest client with additional configuration -// svc := outputservice12protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService12ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService12ProtocolTest { - c := p.ClientConfig("outputservice12protocoltest", cfgs...) - return newOutputService12ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService12ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService12ProtocolTest { - svc := &OutputService12ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice12protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService12TestCaseOperation1 = "OperationName" - -// OutputService12TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService12TestCaseOperation1 operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See OutputService12TestCaseOperation1 for more information on using the OutputService12TestCaseOperation1 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the OutputService12TestCaseOperation1Request method. -// req, resp := client.OutputService12TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService12TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{} - } - - output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService12TestCaseOperation1 API operation for . -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for 's -// API operation OutputService12TestCaseOperation1 for usage and error information. -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) { - req, out := c.OutputService12TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService12TestCaseOperation1WithContext is the same as OutputService12TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService12TestCaseOperation1 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1WithContext(ctx aws.Context, input *OutputService12TestShapeOutputService12TestCaseOperation1Input, opts ...request.Option) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) { - req, out := c.OutputService12TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService12TestShapeOutputService12TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - Attr aws.JSONValue `location:"header" locationName:"X-Amz-Foo" type:"jsonvalue"` -} - -// SetAttr sets the Attr field's value. -func (s *OutputService12TestShapeOutputService12TestCaseOperation1Output) SetAttr(v aws.JSONValue) *OutputService12TestShapeOutputService12TestCaseOperation1Output { - s.Attr = v - return s -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("ImaHeader", "test") - req.HTTPResponse.Header.Set("X-Foo", "abc") - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.Char; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := 1.3, *out.Double; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := false, *out.FalseBool; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := 1.2, *out.Float; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "test", *out.ImaHeader; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "abc", *out.ImaHeaderLocation; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(200), *out.Long; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(123), *out.Num; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(200), *out.Status; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "myname", *out.Str; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := true, *out.TrueBool; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "hi!", string(out.BlobMember); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "there!", string(out.StructMember.Foo); e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { - svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.ListMember[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "b", *out.ListMember[1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService5ProtocolTestListsWithStructureMemberCase1(t *testing.T) { - svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"ListMember\": [{\"Foo\": \"a\"}, {\"Foo\": \"b\"}]}")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "a", *out.ListMember[0].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "b", *out.ListMember[1].Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService6ProtocolTestMapsCase1(t *testing.T) { - svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := int64(1), *out.MapMember["a"][0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(2), *out.MapMember["a"][1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(3), *out.MapMember["b"][0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(4), *out.MapMember["b"][1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService7ProtocolTestComplexMapValuesCase1(t *testing.T) { - svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": 1398796238, \"b\": 1398796238}}")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.MapMember["a"].String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.MapMember["b"].String(); e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService8ProtocolTestIgnoresExtraDataCase1(t *testing.T) { - svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - -} - -func TestOutputService9ProtocolTestSupportsHeaderMapsCase1(t *testing.T) { - svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{}")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("Content-Length", "10") - req.HTTPResponse.Header.Set("X-Bam", "boo") - req.HTTPResponse.Header.Set("X-Foo", "bar") - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "10", *out.AllHeaders["Content-Length"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "boo", *out.AllHeaders["X-Bam"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "bar", *out.AllHeaders["X-Foo"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "boo", *out.PrefixedHeaders["Bam"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "bar", *out.PrefixedHeaders["Foo"]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService10ProtocolTestJSONPayloadCase1(t *testing.T) { - svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("{\"Foo\": \"abc\"}")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("X-Foo", "baz") - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "abc", *out.Data.Foo; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "baz", *out.Header; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService11ProtocolTestStreamingPayloadCase1(t *testing.T) { - svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - if e, a := "abc", string(out.Stream); e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService12ProtocolTestJSONValueTraitCase1(t *testing.T) { - svc := NewOutputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("")) - req, out := svc.OutputService12TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("X-Amz-Foo", "eyJGb28iOiJCYXIifQ==") - - // unmarshal response - restjson.UnmarshalMeta(req) - restjson.Unmarshal(req) - if req.Error != nil { - t.Errorf("expect not error, got %v", req.Error) - } - - // assert response - if out == nil { - t.Errorf("expect not to be nil") - } - reflect.DeepEqual(out.Attr, map[string]interface{}{"Foo": "Bar"}) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go deleted file mode 100644 index da1a6811..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go +++ /dev/null @@ -1,21 +0,0 @@ -package protocol - -import ( - "io" - "io/ioutil" - - "github.com/aws/aws-sdk-go/aws/request" -) - -// UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body -var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} - -// UnmarshalDiscardBody is a request handler to empty a response's body and closing it. -func UnmarshalDiscardBody(r *request.Request) { - if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { - return - } - - io.Copy(ioutil.Discard, r.HTTPResponse.Body) - r.HTTPResponse.Body.Close() -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_test.go deleted file mode 100644 index 2733e993..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package protocol_test - -import ( - "net/http" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/stretchr/testify/assert" -) - -type mockCloser struct { - *strings.Reader - Closed bool -} - -func (m *mockCloser) Close() error { - m.Closed = true - return nil -} - -func TestUnmarshalDrainBody(t *testing.T) { - b := &mockCloser{Reader: strings.NewReader("example body")} - r := &request.Request{HTTPResponse: &http.Response{ - Body: b, - }} - - protocol.UnmarshalDiscardBody(r) - assert.NoError(t, r.Error) - assert.Equal(t, 0, b.Len()) - assert.True(t, b.Closed) -} - -func TestUnmarshalDrainBodyNoBody(t *testing.T) { - r := &request.Request{HTTPResponse: &http.Response{}} - - protocol.UnmarshalDiscardBody(r) - assert.NoError(t, r.Error) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go deleted file mode 100644 index 7091b456..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go +++ /dev/null @@ -1,296 +0,0 @@ -// Package xmlutil provides XML serialization of AWS requests and responses. -package xmlutil - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - "reflect" - "sort" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/private/protocol" -) - -// BuildXML will serialize params into an xml.Encoder. -// Error will be returned if the serialization of any of the params or nested values fails. -func BuildXML(params interface{}, e *xml.Encoder) error { - b := xmlBuilder{encoder: e, namespaces: map[string]string{}} - root := NewXMLElement(xml.Name{}) - if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { - return err - } - for _, c := range root.Children { - for _, v := range c { - return StructToXML(e, v, false) - } - } - return nil -} - -// Returns the reflection element of a value, if it is a pointer. -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} - -// A xmlBuilder serializes values from Go code to XML -type xmlBuilder struct { - encoder *xml.Encoder - namespaces map[string]string -} - -// buildValue generic XMLNode builder for any type. Will build value for their specific type -// struct, list, map, scalar. -// -// Also takes a "type" tag value to set what type a value should be converted to XMLNode as. If -// type is not provided reflect will be used to determine the value's type. -func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - value = elemOf(value) - if !value.IsValid() { // no need to handle zero values - return nil - } else if tag.Get("location") != "" { // don't handle non-body location values - return nil - } - - t := tag.Get("type") - if t == "" { - switch value.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := value.Type().FieldByName("_"); ok { - tag = tag + reflect.StructTag(" ") + field.Tag - } - return b.buildStruct(value, current, tag) - case "list": - return b.buildList(value, current, tag) - case "map": - return b.buildMap(value, current, tag) - default: - return b.buildScalar(value, current, tag) - } -} - -// buildStruct adds a struct and its fields to the current XMLNode. All fields any any nested -// types are converted to XMLNodes also. -func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if !value.IsValid() { - return nil - } - - fieldAdded := false - - // unwrap payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := value.Type().FieldByName(payload) - tag = field.Tag - value = elemOf(value.FieldByName(payload)) - - if !value.IsValid() { - return nil - } - } - - child := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) - - // there is an xmlNamespace associated with this struct - if prefix, uri := tag.Get("xmlPrefix"), tag.Get("xmlURI"); uri != "" { - ns := xml.Attr{ - Name: xml.Name{Local: "xmlns"}, - Value: uri, - } - if prefix != "" { - b.namespaces[prefix] = uri // register the namespace - ns.Name.Local = "xmlns:" + prefix - } - - child.Attr = append(child.Attr, ns) - } - - t := value.Type() - for i := 0; i < value.NumField(); i++ { - member := elemOf(value.Field(i)) - field := t.Field(i) - - if field.PkgPath != "" { - continue // ignore unexported fields - } - if field.Tag.Get("ignore") != "" { - continue - } - - mTag := field.Tag - if mTag.Get("location") != "" { // skip non-body members - continue - } - - if protocol.CanSetIdempotencyToken(value.Field(i), field) { - token := protocol.GetIdempotencyToken() - member = reflect.ValueOf(token) - } - - memberName := mTag.Get("locationName") - if memberName == "" { - memberName = field.Name - mTag = reflect.StructTag(string(mTag) + ` locationName:"` + memberName + `"`) - } - if err := b.buildValue(member, child, mTag); err != nil { - return err - } - - fieldAdded = true - } - - if fieldAdded { // only append this child if we have one ore more valid members - current.AddChild(child) - } - - return nil -} - -// buildList adds the value's list items to the current XMLNode as children nodes. All -// nested values in the list are converted to XMLNodes also. -func (b *xmlBuilder) buildList(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if value.IsNil() { // don't build omitted lists - return nil - } - - // check for unflattened list member - flattened := tag.Get("flattened") != "" - - xname := xml.Name{Local: tag.Get("locationName")} - if flattened { - for i := 0; i < value.Len(); i++ { - child := NewXMLElement(xname) - current.AddChild(child) - if err := b.buildValue(value.Index(i), child, ""); err != nil { - return err - } - } - } else { - list := NewXMLElement(xname) - current.AddChild(list) - - for i := 0; i < value.Len(); i++ { - iname := tag.Get("locationNameList") - if iname == "" { - iname = "member" - } - - child := NewXMLElement(xml.Name{Local: iname}) - list.AddChild(child) - if err := b.buildValue(value.Index(i), child, ""); err != nil { - return err - } - } - } - - return nil -} - -// buildMap adds the value's key/value pairs to the current XMLNode as children nodes. All -// nested values in the map are converted to XMLNodes also. -// -// Error will be returned if it is unable to build the map's values into XMLNodes -func (b *xmlBuilder) buildMap(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if value.IsNil() { // don't build omitted maps - return nil - } - - maproot := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) - current.AddChild(maproot) - current = maproot - - kname, vname := "key", "value" - if n := tag.Get("locationNameKey"); n != "" { - kname = n - } - if n := tag.Get("locationNameValue"); n != "" { - vname = n - } - - // sorting is not required for compliance, but it makes testing easier - keys := make([]string, value.Len()) - for i, k := range value.MapKeys() { - keys[i] = k.String() - } - sort.Strings(keys) - - for _, k := range keys { - v := value.MapIndex(reflect.ValueOf(k)) - - mapcur := current - if tag.Get("flattened") == "" { // add "entry" tag to non-flat maps - child := NewXMLElement(xml.Name{Local: "entry"}) - mapcur.AddChild(child) - mapcur = child - } - - kchild := NewXMLElement(xml.Name{Local: kname}) - kchild.Text = k - vchild := NewXMLElement(xml.Name{Local: vname}) - mapcur.AddChild(kchild) - mapcur.AddChild(vchild) - - if err := b.buildValue(v, vchild, ""); err != nil { - return err - } - } - - return nil -} - -// buildScalar will convert the value into a string and append it as a attribute or child -// of the current XMLNode. -// -// The value will be added as an attribute if tag contains a "xmlAttribute" attribute value. -// -// Error will be returned if the value type is unsupported. -func (b *xmlBuilder) buildScalar(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - var str string - switch converted := value.Interface().(type) { - case string: - str = converted - case []byte: - if !value.IsNil() { - str = base64.StdEncoding.EncodeToString(converted) - } - case bool: - str = strconv.FormatBool(converted) - case int64: - str = strconv.FormatInt(converted, 10) - case int: - str = strconv.Itoa(converted) - case float64: - str = strconv.FormatFloat(converted, 'f', -1, 64) - case float32: - str = strconv.FormatFloat(float64(converted), 'f', -1, 32) - case time.Time: - const ISO8601UTC = "2006-01-02T15:04:05Z" - str = converted.UTC().Format(ISO8601UTC) - default: - return fmt.Errorf("unsupported value for param %s: %v (%s)", - tag.Get("locationName"), value.Interface(), value.Type().Name()) - } - - xname := xml.Name{Local: tag.Get("locationName")} - if tag.Get("xmlAttribute") != "" { // put into current node's attribute list - attr := xml.Attr{Name: xname, Value: str} - current.Attr = append(current.Attr, attr) - } else { // regular text node - current.AddChild(&XMLNode{Name: xname, Text: str}) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go deleted file mode 100644 index 87584628..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go +++ /dev/null @@ -1,260 +0,0 @@ -package xmlutil - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - "io" - "reflect" - "strconv" - "strings" - "time" -) - -// UnmarshalXML deserializes an xml.Decoder into the container v. V -// needs to match the shape of the XML expected to be decoded. -// If the shape doesn't match unmarshaling will fail. -func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error { - n, err := XMLToStruct(d, nil) - if err != nil { - return err - } - if n.Children != nil { - for _, root := range n.Children { - for _, c := range root { - if wrappedChild, ok := c.Children[wrapper]; ok { - c = wrappedChild[0] // pull out wrapped element - } - - err = parse(reflect.ValueOf(v), c, "") - if err != nil { - if err == io.EOF { - return nil - } - return err - } - } - } - return nil - } - return nil -} - -// parse deserializes any value from the XMLNode. The type tag is used to infer the type, or reflect -// will be used to determine the type from r. -func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - rtype := r.Type() - if rtype.Kind() == reflect.Ptr { - rtype = rtype.Elem() // check kind of actual element type - } - - t := tag.Get("type") - if t == "" { - switch rtype.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := rtype.FieldByName("_"); ok { - tag = field.Tag - } - return parseStruct(r, node, tag) - case "list": - return parseList(r, node, tag) - case "map": - return parseMap(r, node, tag) - default: - return parseScalar(r, node, tag) - } -} - -// parseStruct deserializes a structure and its fields from an XMLNode. Any nested -// types in the structure will also be deserialized. -func parseStruct(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - t := r.Type() - if r.Kind() == reflect.Ptr { - if r.IsNil() { // create the structure if it's nil - s := reflect.New(r.Type().Elem()) - r.Set(s) - r = s - } - - r = r.Elem() - t = t.Elem() - } - - // unwrap any payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := t.FieldByName(payload) - return parseStruct(r.FieldByName(payload), node, field.Tag) - } - - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - if c := field.Name[0:1]; strings.ToLower(c) == c { - continue // ignore unexported fields - } - - // figure out what this field is called - name := field.Name - if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { - name = field.Tag.Get("locationNameList") - } else if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - - // try to find the field by name in elements - elems := node.Children[name] - - if elems == nil { // try to find the field in attributes - if val, ok := node.findElem(name); ok { - elems = []*XMLNode{{Text: val}} - } - } - - member := r.FieldByName(field.Name) - for _, elem := range elems { - err := parse(member, elem, field.Tag) - if err != nil { - return err - } - } - } - return nil -} - -// parseList deserializes a list of values from an XML node. Each list entry -// will also be deserialized. -func parseList(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - t := r.Type() - - if tag.Get("flattened") == "" { // look at all item entries - mname := "member" - if name := tag.Get("locationNameList"); name != "" { - mname = name - } - - if Children, ok := node.Children[mname]; ok { - if r.IsNil() { - r.Set(reflect.MakeSlice(t, len(Children), len(Children))) - } - - for i, c := range Children { - err := parse(r.Index(i), c, "") - if err != nil { - return err - } - } - } - } else { // flattened list means this is a single element - if r.IsNil() { - r.Set(reflect.MakeSlice(t, 0, 0)) - } - - childR := reflect.Zero(t.Elem()) - r.Set(reflect.Append(r, childR)) - err := parse(r.Index(r.Len()-1), node, "") - if err != nil { - return err - } - } - - return nil -} - -// parseMap deserializes a map from an XMLNode. The direct children of the XMLNode -// will also be deserialized as map entries. -func parseMap(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - if r.IsNil() { - r.Set(reflect.MakeMap(r.Type())) - } - - if tag.Get("flattened") == "" { // look at all child entries - for _, entry := range node.Children["entry"] { - parseMapEntry(r, entry, tag) - } - } else { // this element is itself an entry - parseMapEntry(r, node, tag) - } - - return nil -} - -// parseMapEntry deserializes a map entry from a XML node. -func parseMapEntry(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - kname, vname := "key", "value" - if n := tag.Get("locationNameKey"); n != "" { - kname = n - } - if n := tag.Get("locationNameValue"); n != "" { - vname = n - } - - keys, ok := node.Children[kname] - values := node.Children[vname] - if ok { - for i, key := range keys { - keyR := reflect.ValueOf(key.Text) - value := values[i] - valueR := reflect.New(r.Type().Elem()).Elem() - - parse(valueR, value, "") - r.SetMapIndex(keyR, valueR) - } - } - return nil -} - -// parseScaller deserializes an XMLNode value into a concrete type based on the -// interface type of r. -// -// Error is returned if the deserialization fails due to invalid type conversion, -// or unsupported interface type. -func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - switch r.Interface().(type) { - case *string: - r.Set(reflect.ValueOf(&node.Text)) - return nil - case []byte: - b, err := base64.StdEncoding.DecodeString(node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(b)) - case *bool: - v, err := strconv.ParseBool(node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *int64: - v, err := strconv.ParseInt(node.Text, 10, 64) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *float64: - v, err := strconv.ParseFloat(node.Text, 64) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *time.Time: - const ISO8601UTC = "2006-01-02T15:04:05Z" - t, err := time.Parse(ISO8601UTC, node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&t)) - default: - return fmt.Errorf("unsupported value: %v (%s)", r.Interface(), r.Type()) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go deleted file mode 100644 index 1185d232..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package xmlutil - -import ( - "encoding/xml" - "fmt" - "io" - "reflect" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -type mockBody struct { - DoneErr error - Body io.Reader -} - -func (m *mockBody) Read(p []byte) (int, error) { - n, err := m.Body.Read(p) - if (n == 0 || err == io.EOF) && m.DoneErr != nil { - return n, m.DoneErr - } - - return n, err -} - -type mockOutput struct { - _ struct{} `type:"structure"` - String *string `type:"string"` - Integer *int64 `type:"integer"` - Nested *mockNestedStruct `type:"structure"` - List []*mockListElem `locationName:"List" locationNameList:"Elem" type:"list"` - Closed *mockClosedTags `type:"structure"` -} -type mockNestedStruct struct { - _ struct{} `type:"structure"` - NestedString *string `type:"string"` - NestedInt *int64 `type:"integer"` -} -type mockClosedTags struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - Attr *string `locationName:"xsi:attrval" type:"string" xmlAttribute:"true"` -} -type mockListElem struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - String *string `type:"string"` - NestedElem *mockNestedListElem `type:"structure"` -} -type mockNestedListElem struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - String *string `type:"string"` - Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true"` -} - -func TestUnmarshal(t *testing.T) { - const xmlBodyStr = ` - - string value - 123 - - - nested string value - 321 - - - - - nested elem string value - - elem string value - - -` - - expect := mockOutput{ - String: aws.String("string value"), - Integer: aws.Int64(123), - Closed: &mockClosedTags{ - Attr: aws.String("attr value"), - }, - Nested: &mockNestedStruct{ - NestedString: aws.String("nested string value"), - NestedInt: aws.Int64(321), - }, - List: []*mockListElem{ - { - String: aws.String("elem string value"), - NestedElem: &mockNestedListElem{ - String: aws.String("nested elem string value"), - Type: aws.String("type"), - }, - }, - }, - } - - actual := mockOutput{} - decoder := xml.NewDecoder(strings.NewReader(xmlBodyStr)) - err := UnmarshalXML(&actual, decoder, "") - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - if !reflect.DeepEqual(expect, actual) { - t.Errorf("expect unmarshal to match\nExpect: %s\nActual: %s", - awsutil.Prettify(expect), awsutil.Prettify(actual)) - } -} - -func TestUnmarshal_UnexpectedEOF(t *testing.T) { - const partialXMLBody = ` - first value - Second val` - - out := struct { - First *string `locationName:"First" type:"string"` - Second *string `locationName:"Second" type:"string"` - }{} - - expect := out - expect.First = aws.String("first") - expect.Second = aws.String("second") - - expectErr := fmt.Errorf("expected read error") - - body := &mockBody{ - DoneErr: expectErr, - Body: strings.NewReader(partialXMLBody), - } - - decoder := xml.NewDecoder(body) - err := UnmarshalXML(&out, decoder, "") - - if err == nil { - t.Fatalf("expect error, got none") - } - if e, a := expectErr, err; e != a { - t.Errorf("expect %v error in %v, but was not", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go deleted file mode 100644 index 3e970b62..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go +++ /dev/null @@ -1,147 +0,0 @@ -package xmlutil - -import ( - "encoding/xml" - "fmt" - "io" - "sort" -) - -// A XMLNode contains the values to be encoded or decoded. -type XMLNode struct { - Name xml.Name `json:",omitempty"` - Children map[string][]*XMLNode `json:",omitempty"` - Text string `json:",omitempty"` - Attr []xml.Attr `json:",omitempty"` - - namespaces map[string]string - parent *XMLNode -} - -// NewXMLElement returns a pointer to a new XMLNode initialized to default values. -func NewXMLElement(name xml.Name) *XMLNode { - return &XMLNode{ - Name: name, - Children: map[string][]*XMLNode{}, - Attr: []xml.Attr{}, - } -} - -// AddChild adds child to the XMLNode. -func (n *XMLNode) AddChild(child *XMLNode) { - if _, ok := n.Children[child.Name.Local]; !ok { - n.Children[child.Name.Local] = []*XMLNode{} - } - n.Children[child.Name.Local] = append(n.Children[child.Name.Local], child) -} - -// XMLToStruct converts a xml.Decoder stream to XMLNode with nested values. -func XMLToStruct(d *xml.Decoder, s *xml.StartElement) (*XMLNode, error) { - out := &XMLNode{} - for { - tok, err := d.Token() - if err != nil { - if err == io.EOF { - break - } else { - return out, err - } - } - - if tok == nil { - break - } - - switch typed := tok.(type) { - case xml.CharData: - out.Text = string(typed.Copy()) - case xml.StartElement: - el := typed.Copy() - out.Attr = el.Attr - if out.Children == nil { - out.Children = map[string][]*XMLNode{} - } - - name := typed.Name.Local - slice := out.Children[name] - if slice == nil { - slice = []*XMLNode{} - } - node, e := XMLToStruct(d, &el) - out.findNamespaces() - if e != nil { - return out, e - } - node.Name = typed.Name - node.findNamespaces() - tempOut := *out - // Save into a temp variable, simply because out gets squashed during - // loop iterations - node.parent = &tempOut - slice = append(slice, node) - out.Children[name] = slice - case xml.EndElement: - if s != nil && s.Name.Local == typed.Name.Local { // matching end token - return out, nil - } - out = &XMLNode{} - } - } - return out, nil -} - -func (n *XMLNode) findNamespaces() { - ns := map[string]string{} - for _, a := range n.Attr { - if a.Name.Space == "xmlns" { - ns[a.Value] = a.Name.Local - } - } - - n.namespaces = ns -} - -func (n *XMLNode) findElem(name string) (string, bool) { - for node := n; node != nil; node = node.parent { - for _, a := range node.Attr { - namespace := a.Name.Space - if v, ok := node.namespaces[namespace]; ok { - namespace = v - } - if name == fmt.Sprintf("%s:%s", namespace, a.Name.Local) { - return a.Value, true - } - } - } - return "", false -} - -// StructToXML writes an XMLNode to a xml.Encoder as tokens. -func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error { - e.EncodeToken(xml.StartElement{Name: node.Name, Attr: node.Attr}) - - if node.Text != "" { - e.EncodeToken(xml.CharData([]byte(node.Text))) - } else if sorted { - sortedNames := []string{} - for k := range node.Children { - sortedNames = append(sortedNames, k) - } - sort.Strings(sortedNames) - - for _, k := range sortedNames { - for _, v := range node.Children[k] { - StructToXML(e, v, sorted) - } - } - } else { - for _, c := range node.Children { - for _, v := range c { - StructToXML(e, v, sorted) - } - } - } - - e.EncodeToken(xml.EndElement{Name: node.Name}) - return e.Flush() -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct_test.go deleted file mode 100644 index 77d12bb7..00000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package xmlutil_test - -import ( - "net/http" - "net/http/httptest" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -func TestUnmarshal(t *testing.T) { - xmlVal := []byte(` - - - foo-id - user - - - - - foo-id - user - - FULL_CONTROL - - -`) - - var server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write(xmlVal) - })) - - sess := unit.Session - sess.Config.Endpoint = &server.URL - sess.Config.S3ForcePathStyle = aws.Bool(true) - svc := s3.New(sess) - - out, err := svc.GetBucketAcl(&s3.GetBucketAclInput{ - Bucket: aws.String("foo"), - }) - - assert.NoError(t, err) - - expected := &s3.GetBucketAclOutput{ - Grants: []*s3.Grant{ - { - Grantee: &s3.Grantee{ - DisplayName: aws.String("user"), - ID: aws.String("foo-id"), - Type: aws.String("type"), - }, - Permission: aws.String("FULL_CONTROL"), - }, - }, - - Owner: &s3.Owner{ - DisplayName: aws.String("user"), - ID: aws.String("foo-id"), - }, - } - assert.Equal(t, expected, out) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/api.go b/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/api.go deleted file mode 100644 index 96ca242f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/api.go +++ /dev/null @@ -1,8004 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elastictranscoder - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" -) - -const opCancelJob = "CancelJob" - -// CancelJobRequest generates a "aws/request.Request" representing the -// client's request for the CancelJob operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CancelJob for more information on using the CancelJob -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CancelJobRequest method. -// req, resp := client.CancelJobRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) CancelJobRequest(input *CancelJobInput) (req *request.Request, output *CancelJobOutput) { - op := &request.Operation{ - Name: opCancelJob, - HTTPMethod: "DELETE", - HTTPPath: "/2012-09-25/jobs/{Id}", - } - - if input == nil { - input = &CancelJobInput{} - } - - output = &CancelJobOutput{} - req = c.newRequest(op, input, output) - return -} - -// CancelJob API operation for Amazon Elastic Transcoder. -// -// The CancelJob operation cancels an unfinished job. -// -// You can only cancel a job that has a status of Submitted. To prevent a pipeline -// from starting to process a job while you're getting the job identifier, use -// UpdatePipelineStatus to temporarily pause the pipeline. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation CancelJob for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeResourceInUseException "ResourceInUseException" -// The resource you are attempting to change is in use. For example, you are -// attempting to delete a pipeline that is currently in use. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) CancelJob(input *CancelJobInput) (*CancelJobOutput, error) { - req, out := c.CancelJobRequest(input) - return out, req.Send() -} - -// CancelJobWithContext is the same as CancelJob with the addition of -// the ability to pass a context and additional request options. -// -// See CancelJob for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) CancelJobWithContext(ctx aws.Context, input *CancelJobInput, opts ...request.Option) (*CancelJobOutput, error) { - req, out := c.CancelJobRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateJob = "CreateJob" - -// CreateJobRequest generates a "aws/request.Request" representing the -// client's request for the CreateJob operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateJob for more information on using the CreateJob -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CreateJobRequest method. -// req, resp := client.CreateJobRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) CreateJobRequest(input *CreateJobInput) (req *request.Request, output *CreateJobResponse) { - op := &request.Operation{ - Name: opCreateJob, - HTTPMethod: "POST", - HTTPPath: "/2012-09-25/jobs", - } - - if input == nil { - input = &CreateJobInput{} - } - - output = &CreateJobResponse{} - req = c.newRequest(op, input, output) - return -} - -// CreateJob API operation for Amazon Elastic Transcoder. -// -// When you create a job, Elastic Transcoder returns JSON data that includes -// the values that you specified plus information about the job that is created. -// -// If you have specified more than one output for your jobs (for example, one -// output for the Kindle Fire and another output for the Apple iPhone 4s), you -// currently must use the Elastic Transcoder API to list the jobs (as opposed -// to the AWS Console). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation CreateJob for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeLimitExceededException "LimitExceededException" -// Too many operations for a given AWS account. For example, the number of pipelines -// exceeds the maximum allowed. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) CreateJob(input *CreateJobInput) (*CreateJobResponse, error) { - req, out := c.CreateJobRequest(input) - return out, req.Send() -} - -// CreateJobWithContext is the same as CreateJob with the addition of -// the ability to pass a context and additional request options. -// -// See CreateJob for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) CreateJobWithContext(ctx aws.Context, input *CreateJobInput, opts ...request.Option) (*CreateJobResponse, error) { - req, out := c.CreateJobRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreatePipeline = "CreatePipeline" - -// CreatePipelineRequest generates a "aws/request.Request" representing the -// client's request for the CreatePipeline operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreatePipeline for more information on using the CreatePipeline -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CreatePipelineRequest method. -// req, resp := client.CreatePipelineRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) CreatePipelineRequest(input *CreatePipelineInput) (req *request.Request, output *CreatePipelineOutput) { - op := &request.Operation{ - Name: opCreatePipeline, - HTTPMethod: "POST", - HTTPPath: "/2012-09-25/pipelines", - } - - if input == nil { - input = &CreatePipelineInput{} - } - - output = &CreatePipelineOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreatePipeline API operation for Amazon Elastic Transcoder. -// -// The CreatePipeline operation creates a pipeline with settings that you specify. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation CreatePipeline for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeLimitExceededException "LimitExceededException" -// Too many operations for a given AWS account. For example, the number of pipelines -// exceeds the maximum allowed. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) CreatePipeline(input *CreatePipelineInput) (*CreatePipelineOutput, error) { - req, out := c.CreatePipelineRequest(input) - return out, req.Send() -} - -// CreatePipelineWithContext is the same as CreatePipeline with the addition of -// the ability to pass a context and additional request options. -// -// See CreatePipeline for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) CreatePipelineWithContext(ctx aws.Context, input *CreatePipelineInput, opts ...request.Option) (*CreatePipelineOutput, error) { - req, out := c.CreatePipelineRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreatePreset = "CreatePreset" - -// CreatePresetRequest generates a "aws/request.Request" representing the -// client's request for the CreatePreset operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreatePreset for more information on using the CreatePreset -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CreatePresetRequest method. -// req, resp := client.CreatePresetRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) CreatePresetRequest(input *CreatePresetInput) (req *request.Request, output *CreatePresetOutput) { - op := &request.Operation{ - Name: opCreatePreset, - HTTPMethod: "POST", - HTTPPath: "/2012-09-25/presets", - } - - if input == nil { - input = &CreatePresetInput{} - } - - output = &CreatePresetOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreatePreset API operation for Amazon Elastic Transcoder. -// -// The CreatePreset operation creates a preset with settings that you specify. -// -// Elastic Transcoder checks the CreatePreset settings to ensure that they meet -// Elastic Transcoder requirements and to determine whether they comply with -// H.264 standards. If your settings are not valid for Elastic Transcoder, Elastic -// Transcoder returns an HTTP 400 response (ValidationException) and does not -// create the preset. If the settings are valid for Elastic Transcoder but aren't -// strictly compliant with the H.264 standard, Elastic Transcoder creates the -// preset and returns a warning message in the response. This helps you determine -// whether your settings comply with the H.264 standard while giving you greater -// flexibility with respect to the video that Elastic Transcoder produces. -// -// Elastic Transcoder uses the H.264 video-compression format. For more information, -// see the International Telecommunication Union publication Recommendation -// ITU-T H.264: Advanced video coding for generic audiovisual services. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation CreatePreset for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeLimitExceededException "LimitExceededException" -// Too many operations for a given AWS account. For example, the number of pipelines -// exceeds the maximum allowed. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) CreatePreset(input *CreatePresetInput) (*CreatePresetOutput, error) { - req, out := c.CreatePresetRequest(input) - return out, req.Send() -} - -// CreatePresetWithContext is the same as CreatePreset with the addition of -// the ability to pass a context and additional request options. -// -// See CreatePreset for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) CreatePresetWithContext(ctx aws.Context, input *CreatePresetInput, opts ...request.Option) (*CreatePresetOutput, error) { - req, out := c.CreatePresetRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeletePipeline = "DeletePipeline" - -// DeletePipelineRequest generates a "aws/request.Request" representing the -// client's request for the DeletePipeline operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeletePipeline for more information on using the DeletePipeline -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeletePipelineRequest method. -// req, resp := client.DeletePipelineRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) DeletePipelineRequest(input *DeletePipelineInput) (req *request.Request, output *DeletePipelineOutput) { - op := &request.Operation{ - Name: opDeletePipeline, - HTTPMethod: "DELETE", - HTTPPath: "/2012-09-25/pipelines/{Id}", - } - - if input == nil { - input = &DeletePipelineInput{} - } - - output = &DeletePipelineOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeletePipeline API operation for Amazon Elastic Transcoder. -// -// The DeletePipeline operation removes a pipeline. -// -// You can only delete a pipeline that has never been used or that is not currently -// in use (doesn't contain any active jobs). If the pipeline is currently in -// use, DeletePipeline returns an error. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation DeletePipeline for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeResourceInUseException "ResourceInUseException" -// The resource you are attempting to change is in use. For example, you are -// attempting to delete a pipeline that is currently in use. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) DeletePipeline(input *DeletePipelineInput) (*DeletePipelineOutput, error) { - req, out := c.DeletePipelineRequest(input) - return out, req.Send() -} - -// DeletePipelineWithContext is the same as DeletePipeline with the addition of -// the ability to pass a context and additional request options. -// -// See DeletePipeline for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) DeletePipelineWithContext(ctx aws.Context, input *DeletePipelineInput, opts ...request.Option) (*DeletePipelineOutput, error) { - req, out := c.DeletePipelineRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeletePreset = "DeletePreset" - -// DeletePresetRequest generates a "aws/request.Request" representing the -// client's request for the DeletePreset operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeletePreset for more information on using the DeletePreset -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeletePresetRequest method. -// req, resp := client.DeletePresetRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) DeletePresetRequest(input *DeletePresetInput) (req *request.Request, output *DeletePresetOutput) { - op := &request.Operation{ - Name: opDeletePreset, - HTTPMethod: "DELETE", - HTTPPath: "/2012-09-25/presets/{Id}", - } - - if input == nil { - input = &DeletePresetInput{} - } - - output = &DeletePresetOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeletePreset API operation for Amazon Elastic Transcoder. -// -// The DeletePreset operation removes a preset that you've added in an AWS region. -// -// You can't delete the default presets that are included with Elastic Transcoder. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation DeletePreset for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) DeletePreset(input *DeletePresetInput) (*DeletePresetOutput, error) { - req, out := c.DeletePresetRequest(input) - return out, req.Send() -} - -// DeletePresetWithContext is the same as DeletePreset with the addition of -// the ability to pass a context and additional request options. -// -// See DeletePreset for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) DeletePresetWithContext(ctx aws.Context, input *DeletePresetInput, opts ...request.Option) (*DeletePresetOutput, error) { - req, out := c.DeletePresetRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListJobsByPipeline = "ListJobsByPipeline" - -// ListJobsByPipelineRequest generates a "aws/request.Request" representing the -// client's request for the ListJobsByPipeline operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListJobsByPipeline for more information on using the ListJobsByPipeline -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListJobsByPipelineRequest method. -// req, resp := client.ListJobsByPipelineRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) ListJobsByPipelineRequest(input *ListJobsByPipelineInput) (req *request.Request, output *ListJobsByPipelineOutput) { - op := &request.Operation{ - Name: opListJobsByPipeline, - HTTPMethod: "GET", - HTTPPath: "/2012-09-25/jobsByPipeline/{PipelineId}", - Paginator: &request.Paginator{ - InputTokens: []string{"PageToken"}, - OutputTokens: []string{"NextPageToken"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &ListJobsByPipelineInput{} - } - - output = &ListJobsByPipelineOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListJobsByPipeline API operation for Amazon Elastic Transcoder. -// -// The ListJobsByPipeline operation gets a list of the jobs currently in a pipeline. -// -// Elastic Transcoder returns all of the jobs currently in the specified pipeline. -// The response body contains one element for each job that satisfies the search -// criteria. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation ListJobsByPipeline for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) ListJobsByPipeline(input *ListJobsByPipelineInput) (*ListJobsByPipelineOutput, error) { - req, out := c.ListJobsByPipelineRequest(input) - return out, req.Send() -} - -// ListJobsByPipelineWithContext is the same as ListJobsByPipeline with the addition of -// the ability to pass a context and additional request options. -// -// See ListJobsByPipeline for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListJobsByPipelineWithContext(ctx aws.Context, input *ListJobsByPipelineInput, opts ...request.Option) (*ListJobsByPipelineOutput, error) { - req, out := c.ListJobsByPipelineRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListJobsByPipelinePages iterates over the pages of a ListJobsByPipeline operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListJobsByPipeline method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListJobsByPipeline operation. -// pageNum := 0 -// err := client.ListJobsByPipelinePages(params, -// func(page *ListJobsByPipelineOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *ElasticTranscoder) ListJobsByPipelinePages(input *ListJobsByPipelineInput, fn func(*ListJobsByPipelineOutput, bool) bool) error { - return c.ListJobsByPipelinePagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListJobsByPipelinePagesWithContext same as ListJobsByPipelinePages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListJobsByPipelinePagesWithContext(ctx aws.Context, input *ListJobsByPipelineInput, fn func(*ListJobsByPipelineOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListJobsByPipelineInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListJobsByPipelineRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListJobsByPipelineOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opListJobsByStatus = "ListJobsByStatus" - -// ListJobsByStatusRequest generates a "aws/request.Request" representing the -// client's request for the ListJobsByStatus operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListJobsByStatus for more information on using the ListJobsByStatus -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListJobsByStatusRequest method. -// req, resp := client.ListJobsByStatusRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) ListJobsByStatusRequest(input *ListJobsByStatusInput) (req *request.Request, output *ListJobsByStatusOutput) { - op := &request.Operation{ - Name: opListJobsByStatus, - HTTPMethod: "GET", - HTTPPath: "/2012-09-25/jobsByStatus/{Status}", - Paginator: &request.Paginator{ - InputTokens: []string{"PageToken"}, - OutputTokens: []string{"NextPageToken"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &ListJobsByStatusInput{} - } - - output = &ListJobsByStatusOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListJobsByStatus API operation for Amazon Elastic Transcoder. -// -// The ListJobsByStatus operation gets a list of jobs that have a specified -// status. The response body contains one element for each job that satisfies -// the search criteria. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation ListJobsByStatus for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) ListJobsByStatus(input *ListJobsByStatusInput) (*ListJobsByStatusOutput, error) { - req, out := c.ListJobsByStatusRequest(input) - return out, req.Send() -} - -// ListJobsByStatusWithContext is the same as ListJobsByStatus with the addition of -// the ability to pass a context and additional request options. -// -// See ListJobsByStatus for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListJobsByStatusWithContext(ctx aws.Context, input *ListJobsByStatusInput, opts ...request.Option) (*ListJobsByStatusOutput, error) { - req, out := c.ListJobsByStatusRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListJobsByStatusPages iterates over the pages of a ListJobsByStatus operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListJobsByStatus method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListJobsByStatus operation. -// pageNum := 0 -// err := client.ListJobsByStatusPages(params, -// func(page *ListJobsByStatusOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool) error { - return c.ListJobsByStatusPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListJobsByStatusPagesWithContext same as ListJobsByStatusPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListJobsByStatusPagesWithContext(ctx aws.Context, input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListJobsByStatusInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListJobsByStatusRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListJobsByStatusOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opListPipelines = "ListPipelines" - -// ListPipelinesRequest generates a "aws/request.Request" representing the -// client's request for the ListPipelines operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListPipelines for more information on using the ListPipelines -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListPipelinesRequest method. -// req, resp := client.ListPipelinesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) ListPipelinesRequest(input *ListPipelinesInput) (req *request.Request, output *ListPipelinesOutput) { - op := &request.Operation{ - Name: opListPipelines, - HTTPMethod: "GET", - HTTPPath: "/2012-09-25/pipelines", - Paginator: &request.Paginator{ - InputTokens: []string{"PageToken"}, - OutputTokens: []string{"NextPageToken"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &ListPipelinesInput{} - } - - output = &ListPipelinesOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListPipelines API operation for Amazon Elastic Transcoder. -// -// The ListPipelines operation gets a list of the pipelines associated with -// the current AWS account. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation ListPipelines for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) ListPipelines(input *ListPipelinesInput) (*ListPipelinesOutput, error) { - req, out := c.ListPipelinesRequest(input) - return out, req.Send() -} - -// ListPipelinesWithContext is the same as ListPipelines with the addition of -// the ability to pass a context and additional request options. -// -// See ListPipelines for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListPipelinesWithContext(ctx aws.Context, input *ListPipelinesInput, opts ...request.Option) (*ListPipelinesOutput, error) { - req, out := c.ListPipelinesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListPipelinesPages iterates over the pages of a ListPipelines operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListPipelines method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListPipelines operation. -// pageNum := 0 -// err := client.ListPipelinesPages(params, -// func(page *ListPipelinesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *ElasticTranscoder) ListPipelinesPages(input *ListPipelinesInput, fn func(*ListPipelinesOutput, bool) bool) error { - return c.ListPipelinesPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListPipelinesPagesWithContext same as ListPipelinesPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListPipelinesPagesWithContext(ctx aws.Context, input *ListPipelinesInput, fn func(*ListPipelinesOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListPipelinesInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListPipelinesRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListPipelinesOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opListPresets = "ListPresets" - -// ListPresetsRequest generates a "aws/request.Request" representing the -// client's request for the ListPresets operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListPresets for more information on using the ListPresets -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListPresetsRequest method. -// req, resp := client.ListPresetsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) ListPresetsRequest(input *ListPresetsInput) (req *request.Request, output *ListPresetsOutput) { - op := &request.Operation{ - Name: opListPresets, - HTTPMethod: "GET", - HTTPPath: "/2012-09-25/presets", - Paginator: &request.Paginator{ - InputTokens: []string{"PageToken"}, - OutputTokens: []string{"NextPageToken"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &ListPresetsInput{} - } - - output = &ListPresetsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListPresets API operation for Amazon Elastic Transcoder. -// -// The ListPresets operation gets a list of the default presets included with -// Elastic Transcoder and the presets that you've added in an AWS region. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation ListPresets for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) ListPresets(input *ListPresetsInput) (*ListPresetsOutput, error) { - req, out := c.ListPresetsRequest(input) - return out, req.Send() -} - -// ListPresetsWithContext is the same as ListPresets with the addition of -// the ability to pass a context and additional request options. -// -// See ListPresets for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListPresetsWithContext(ctx aws.Context, input *ListPresetsInput, opts ...request.Option) (*ListPresetsOutput, error) { - req, out := c.ListPresetsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListPresetsPages iterates over the pages of a ListPresets operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListPresets method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListPresets operation. -// pageNum := 0 -// err := client.ListPresetsPages(params, -// func(page *ListPresetsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *ElasticTranscoder) ListPresetsPages(input *ListPresetsInput, fn func(*ListPresetsOutput, bool) bool) error { - return c.ListPresetsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListPresetsPagesWithContext same as ListPresetsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ListPresetsPagesWithContext(ctx aws.Context, input *ListPresetsInput, fn func(*ListPresetsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListPresetsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListPresetsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListPresetsOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opReadJob = "ReadJob" - -// ReadJobRequest generates a "aws/request.Request" representing the -// client's request for the ReadJob operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ReadJob for more information on using the ReadJob -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ReadJobRequest method. -// req, resp := client.ReadJobRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) ReadJobRequest(input *ReadJobInput) (req *request.Request, output *ReadJobOutput) { - op := &request.Operation{ - Name: opReadJob, - HTTPMethod: "GET", - HTTPPath: "/2012-09-25/jobs/{Id}", - } - - if input == nil { - input = &ReadJobInput{} - } - - output = &ReadJobOutput{} - req = c.newRequest(op, input, output) - return -} - -// ReadJob API operation for Amazon Elastic Transcoder. -// -// The ReadJob operation returns detailed information about a job. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation ReadJob for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) ReadJob(input *ReadJobInput) (*ReadJobOutput, error) { - req, out := c.ReadJobRequest(input) - return out, req.Send() -} - -// ReadJobWithContext is the same as ReadJob with the addition of -// the ability to pass a context and additional request options. -// -// See ReadJob for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ReadJobWithContext(ctx aws.Context, input *ReadJobInput, opts ...request.Option) (*ReadJobOutput, error) { - req, out := c.ReadJobRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opReadPipeline = "ReadPipeline" - -// ReadPipelineRequest generates a "aws/request.Request" representing the -// client's request for the ReadPipeline operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ReadPipeline for more information on using the ReadPipeline -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ReadPipelineRequest method. -// req, resp := client.ReadPipelineRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) ReadPipelineRequest(input *ReadPipelineInput) (req *request.Request, output *ReadPipelineOutput) { - op := &request.Operation{ - Name: opReadPipeline, - HTTPMethod: "GET", - HTTPPath: "/2012-09-25/pipelines/{Id}", - } - - if input == nil { - input = &ReadPipelineInput{} - } - - output = &ReadPipelineOutput{} - req = c.newRequest(op, input, output) - return -} - -// ReadPipeline API operation for Amazon Elastic Transcoder. -// -// The ReadPipeline operation gets detailed information about a pipeline. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation ReadPipeline for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) ReadPipeline(input *ReadPipelineInput) (*ReadPipelineOutput, error) { - req, out := c.ReadPipelineRequest(input) - return out, req.Send() -} - -// ReadPipelineWithContext is the same as ReadPipeline with the addition of -// the ability to pass a context and additional request options. -// -// See ReadPipeline for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ReadPipelineWithContext(ctx aws.Context, input *ReadPipelineInput, opts ...request.Option) (*ReadPipelineOutput, error) { - req, out := c.ReadPipelineRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opReadPreset = "ReadPreset" - -// ReadPresetRequest generates a "aws/request.Request" representing the -// client's request for the ReadPreset operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ReadPreset for more information on using the ReadPreset -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ReadPresetRequest method. -// req, resp := client.ReadPresetRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) ReadPresetRequest(input *ReadPresetInput) (req *request.Request, output *ReadPresetOutput) { - op := &request.Operation{ - Name: opReadPreset, - HTTPMethod: "GET", - HTTPPath: "/2012-09-25/presets/{Id}", - } - - if input == nil { - input = &ReadPresetInput{} - } - - output = &ReadPresetOutput{} - req = c.newRequest(op, input, output) - return -} - -// ReadPreset API operation for Amazon Elastic Transcoder. -// -// The ReadPreset operation gets detailed information about a preset. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation ReadPreset for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) ReadPreset(input *ReadPresetInput) (*ReadPresetOutput, error) { - req, out := c.ReadPresetRequest(input) - return out, req.Send() -} - -// ReadPresetWithContext is the same as ReadPreset with the addition of -// the ability to pass a context and additional request options. -// -// See ReadPreset for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) ReadPresetWithContext(ctx aws.Context, input *ReadPresetInput, opts ...request.Option) (*ReadPresetOutput, error) { - req, out := c.ReadPresetRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opTestRole = "TestRole" - -// TestRoleRequest generates a "aws/request.Request" representing the -// client's request for the TestRole operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See TestRole for more information on using the TestRole -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the TestRoleRequest method. -// req, resp := client.TestRoleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) TestRoleRequest(input *TestRoleInput) (req *request.Request, output *TestRoleOutput) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, TestRole, has been deprecated") - } - op := &request.Operation{ - Name: opTestRole, - HTTPMethod: "POST", - HTTPPath: "/2012-09-25/roleTests", - } - - if input == nil { - input = &TestRoleInput{} - } - - output = &TestRoleOutput{} - req = c.newRequest(op, input, output) - return -} - -// TestRole API operation for Amazon Elastic Transcoder. -// -// The TestRole operation tests the IAM role used to create the pipeline. -// -// The TestRole action lets you determine whether the IAM role you are using -// has sufficient permissions to let Elastic Transcoder perform tasks associated -// with the transcoding process. The action attempts to assume the specified -// IAM role, checks read access to the input and output buckets, and tries to -// send a test notification to Amazon SNS topics that you specify. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation TestRole for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) TestRole(input *TestRoleInput) (*TestRoleOutput, error) { - req, out := c.TestRoleRequest(input) - return out, req.Send() -} - -// TestRoleWithContext is the same as TestRole with the addition of -// the ability to pass a context and additional request options. -// -// See TestRole for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) TestRoleWithContext(ctx aws.Context, input *TestRoleInput, opts ...request.Option) (*TestRoleOutput, error) { - req, out := c.TestRoleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdatePipeline = "UpdatePipeline" - -// UpdatePipelineRequest generates a "aws/request.Request" representing the -// client's request for the UpdatePipeline operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdatePipeline for more information on using the UpdatePipeline -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the UpdatePipelineRequest method. -// req, resp := client.UpdatePipelineRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) UpdatePipelineRequest(input *UpdatePipelineInput) (req *request.Request, output *UpdatePipelineOutput) { - op := &request.Operation{ - Name: opUpdatePipeline, - HTTPMethod: "PUT", - HTTPPath: "/2012-09-25/pipelines/{Id}", - } - - if input == nil { - input = &UpdatePipelineInput{} - } - - output = &UpdatePipelineOutput{} - req = c.newRequest(op, input, output) - return -} - -// UpdatePipeline API operation for Amazon Elastic Transcoder. -// -// Use the UpdatePipeline operation to update settings for a pipeline. -// -// When you change pipeline settings, your changes take effect immediately. -// Jobs that you have already submitted and that Elastic Transcoder has not -// started to process are affected in addition to jobs that you submit after -// you change settings. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation UpdatePipeline for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeResourceInUseException "ResourceInUseException" -// The resource you are attempting to change is in use. For example, you are -// attempting to delete a pipeline that is currently in use. -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) UpdatePipeline(input *UpdatePipelineInput) (*UpdatePipelineOutput, error) { - req, out := c.UpdatePipelineRequest(input) - return out, req.Send() -} - -// UpdatePipelineWithContext is the same as UpdatePipeline with the addition of -// the ability to pass a context and additional request options. -// -// See UpdatePipeline for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) UpdatePipelineWithContext(ctx aws.Context, input *UpdatePipelineInput, opts ...request.Option) (*UpdatePipelineOutput, error) { - req, out := c.UpdatePipelineRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdatePipelineNotifications = "UpdatePipelineNotifications" - -// UpdatePipelineNotificationsRequest generates a "aws/request.Request" representing the -// client's request for the UpdatePipelineNotifications operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdatePipelineNotifications for more information on using the UpdatePipelineNotifications -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the UpdatePipelineNotificationsRequest method. -// req, resp := client.UpdatePipelineNotificationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) UpdatePipelineNotificationsRequest(input *UpdatePipelineNotificationsInput) (req *request.Request, output *UpdatePipelineNotificationsOutput) { - op := &request.Operation{ - Name: opUpdatePipelineNotifications, - HTTPMethod: "POST", - HTTPPath: "/2012-09-25/pipelines/{Id}/notifications", - } - - if input == nil { - input = &UpdatePipelineNotificationsInput{} - } - - output = &UpdatePipelineNotificationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// UpdatePipelineNotifications API operation for Amazon Elastic Transcoder. -// -// With the UpdatePipelineNotifications operation, you can update Amazon Simple -// Notification Service (Amazon SNS) notifications for a pipeline. -// -// When you update notifications for a pipeline, Elastic Transcoder returns -// the values that you specified in the request. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation UpdatePipelineNotifications for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeResourceInUseException "ResourceInUseException" -// The resource you are attempting to change is in use. For example, you are -// attempting to delete a pipeline that is currently in use. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) UpdatePipelineNotifications(input *UpdatePipelineNotificationsInput) (*UpdatePipelineNotificationsOutput, error) { - req, out := c.UpdatePipelineNotificationsRequest(input) - return out, req.Send() -} - -// UpdatePipelineNotificationsWithContext is the same as UpdatePipelineNotifications with the addition of -// the ability to pass a context and additional request options. -// -// See UpdatePipelineNotifications for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) UpdatePipelineNotificationsWithContext(ctx aws.Context, input *UpdatePipelineNotificationsInput, opts ...request.Option) (*UpdatePipelineNotificationsOutput, error) { - req, out := c.UpdatePipelineNotificationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdatePipelineStatus = "UpdatePipelineStatus" - -// UpdatePipelineStatusRequest generates a "aws/request.Request" representing the -// client's request for the UpdatePipelineStatus operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdatePipelineStatus for more information on using the UpdatePipelineStatus -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the UpdatePipelineStatusRequest method. -// req, resp := client.UpdatePipelineStatusRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *ElasticTranscoder) UpdatePipelineStatusRequest(input *UpdatePipelineStatusInput) (req *request.Request, output *UpdatePipelineStatusOutput) { - op := &request.Operation{ - Name: opUpdatePipelineStatus, - HTTPMethod: "POST", - HTTPPath: "/2012-09-25/pipelines/{Id}/status", - } - - if input == nil { - input = &UpdatePipelineStatusInput{} - } - - output = &UpdatePipelineStatusOutput{} - req = c.newRequest(op, input, output) - return -} - -// UpdatePipelineStatus API operation for Amazon Elastic Transcoder. -// -// The UpdatePipelineStatus operation pauses or reactivates a pipeline, so that -// the pipeline stops or restarts the processing of jobs. -// -// Changing the pipeline status is useful if you want to cancel one or more -// jobs. You can't cancel jobs after Elastic Transcoder has started processing -// them; if you pause the pipeline to which you submitted the jobs, you have -// more time to get the job IDs for the jobs that you want to cancel, and to -// send a CancelJob request. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Elastic Transcoder's -// API operation UpdatePipelineStatus for usage and error information. -// -// Returned Error Codes: -// * ErrCodeValidationException "ValidationException" -// One or more required parameter values were not provided in the request. -// -// * ErrCodeIncompatibleVersionException "IncompatibleVersionException" -// -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// The requested resource does not exist or is not available. For example, the -// pipeline to which you're trying to add a job doesn't exist or is still being -// created. -// -// * ErrCodeResourceInUseException "ResourceInUseException" -// The resource you are attempting to change is in use. For example, you are -// attempting to delete a pipeline that is currently in use. -// -// * ErrCodeAccessDeniedException "AccessDeniedException" -// General authentication failure. The request was not signed correctly. -// -// * ErrCodeInternalServiceException "InternalServiceException" -// Elastic Transcoder encountered an unexpected exception while trying to fulfill -// the request. -// -func (c *ElasticTranscoder) UpdatePipelineStatus(input *UpdatePipelineStatusInput) (*UpdatePipelineStatusOutput, error) { - req, out := c.UpdatePipelineStatusRequest(input) - return out, req.Send() -} - -// UpdatePipelineStatusWithContext is the same as UpdatePipelineStatus with the addition of -// the ability to pass a context and additional request options. -// -// See UpdatePipelineStatus for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) UpdatePipelineStatusWithContext(ctx aws.Context, input *UpdatePipelineStatusInput, opts ...request.Option) (*UpdatePipelineStatusOutput, error) { - req, out := c.UpdatePipelineStatusRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// The file to be used as album art. There can be multiple artworks associated -// with an audio file, to a maximum of 20. -// -// To remove artwork or leave the artwork empty, you can either set Artwork -// to null, or set the Merge Policy to "Replace" and use an empty Artwork array. -// -// To pass through existing artwork unchanged, set the Merge Policy to "Prepend", -// "Append", or "Fallback", and use an empty Artwork array. -type Artwork struct { - _ struct{} `type:"structure"` - - // The format of album art, if any. Valid formats are .jpg and .png. - AlbumArtFormat *string `type:"string"` - - // The encryption settings, if any, that you want Elastic Transcoder to apply - // to your artwork. - Encryption *Encryption `type:"structure"` - - // The name of the file to be used as album art. To determine which Amazon S3 - // bucket contains the specified file, Elastic Transcoder checks the pipeline - // specified by PipelineId; the InputBucket object in that pipeline identifies - // the bucket. - // - // If the file name includes a prefix, for example, cooking/pie.jpg, include - // the prefix in the key. If the file isn't in the specified bucket, Elastic - // Transcoder returns an error. - InputKey *string `min:"1" type:"string"` - - // The maximum height of the output album art in pixels. If you specify auto, - // Elastic Transcoder uses 600 as the default value. If you specify a numeric - // value, enter an even integer between 32 and 3072, inclusive. - MaxHeight *string `type:"string"` - - // The maximum width of the output album art in pixels. If you specify auto, - // Elastic Transcoder uses 600 as the default value. If you specify a numeric - // value, enter an even integer between 32 and 4096, inclusive. - MaxWidth *string `type:"string"` - - // When you set PaddingPolicy to Pad, Elastic Transcoder may add white bars - // to the top and bottom and/or left and right sides of the output album art - // to make the total size of the output art match the values that you specified - // for MaxWidth and MaxHeight. - PaddingPolicy *string `type:"string"` - - // Specify one of the following values to control scaling of the output album - // art: - // - // * Fit: Elastic Transcoder scales the output art so it matches the value - // that you specified in either MaxWidth or MaxHeight without exceeding the - // other value. - // - // * Fill: Elastic Transcoder scales the output art so it matches the value - // that you specified in either MaxWidth or MaxHeight and matches or exceeds - // the other value. Elastic Transcoder centers the output art and then crops - // it in the dimension (if any) that exceeds the maximum value. - // - // * Stretch: Elastic Transcoder stretches the output art to match the values - // that you specified for MaxWidth and MaxHeight. If the relative proportions - // of the input art and the output art are different, the output art will - // be distorted. - // - // * Keep: Elastic Transcoder does not scale the output art. If either dimension - // of the input art exceeds the values that you specified for MaxWidth and - // MaxHeight, Elastic Transcoder crops the output art. - // - // * ShrinkToFit: Elastic Transcoder scales the output art down so that its - // dimensions match the values that you specified for at least one of MaxWidth - // and MaxHeight without exceeding either value. If you specify this option, - // Elastic Transcoder does not scale the art up. - // - // * ShrinkToFill Elastic Transcoder scales the output art down so that its - // dimensions match the values that you specified for at least one of MaxWidth - // and MaxHeight without dropping below either value. If you specify this - // option, Elastic Transcoder does not scale the art up. - SizingPolicy *string `type:"string"` -} - -// String returns the string representation -func (s Artwork) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Artwork) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Artwork) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Artwork"} - if s.InputKey != nil && len(*s.InputKey) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InputKey", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAlbumArtFormat sets the AlbumArtFormat field's value. -func (s *Artwork) SetAlbumArtFormat(v string) *Artwork { - s.AlbumArtFormat = &v - return s -} - -// SetEncryption sets the Encryption field's value. -func (s *Artwork) SetEncryption(v *Encryption) *Artwork { - s.Encryption = v - return s -} - -// SetInputKey sets the InputKey field's value. -func (s *Artwork) SetInputKey(v string) *Artwork { - s.InputKey = &v - return s -} - -// SetMaxHeight sets the MaxHeight field's value. -func (s *Artwork) SetMaxHeight(v string) *Artwork { - s.MaxHeight = &v - return s -} - -// SetMaxWidth sets the MaxWidth field's value. -func (s *Artwork) SetMaxWidth(v string) *Artwork { - s.MaxWidth = &v - return s -} - -// SetPaddingPolicy sets the PaddingPolicy field's value. -func (s *Artwork) SetPaddingPolicy(v string) *Artwork { - s.PaddingPolicy = &v - return s -} - -// SetSizingPolicy sets the SizingPolicy field's value. -func (s *Artwork) SetSizingPolicy(v string) *Artwork { - s.SizingPolicy = &v - return s -} - -// Options associated with your audio codec. -type AudioCodecOptions struct { - _ struct{} `type:"structure"` - - // You can only choose an audio bit depth when you specify flac or pcm for the - // value of Audio:Codec. - // - // The bit depth of a sample is how many bits of information are included in - // the audio samples. The higher the bit depth, the better the audio, but the - // larger the file. - // - // Valid values are 16 and 24. - // - // The most common bit depth is 24. - BitDepth *string `type:"string"` - - // You can only choose an audio bit order when you specify pcm for the value - // of Audio:Codec. - // - // The order the bits of a PCM sample are stored in. - // - // The supported value is LittleEndian. - BitOrder *string `type:"string"` - - // You can only choose an audio profile when you specify AAC for the value of - // Audio:Codec. - // - // Specify the AAC profile for the output file. Elastic Transcoder supports - // the following profiles: - // - // * auto: If you specify auto, Elastic Transcoder selects the profile based - // on the bit rate selected for the output file. - // - // * AAC-LC: The most common AAC profile. Use for bit rates larger than 64 - // kbps. - // - // * HE-AAC: Not supported on some older players and devices. Use for bit - // rates between 40 and 80 kbps. - // - // * HE-AACv2: Not supported on some players and devices. Use for bit rates - // less than 48 kbps. - // - // All outputs in a Smooth playlist must have the same value for Profile. - // - // If you created any presets before AAC profiles were added, Elastic Transcoder - // automatically updated your presets to use AAC-LC. You can change the value - // as required. - Profile *string `type:"string"` - - // You can only choose whether an audio sample is signed when you specify pcm - // for the value of Audio:Codec. - // - // Whether audio samples are represented with negative and positive numbers - // (signed) or only positive numbers (unsigned). - // - // The supported value is Signed. - Signed *string `type:"string"` -} - -// String returns the string representation -func (s AudioCodecOptions) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AudioCodecOptions) GoString() string { - return s.String() -} - -// SetBitDepth sets the BitDepth field's value. -func (s *AudioCodecOptions) SetBitDepth(v string) *AudioCodecOptions { - s.BitDepth = &v - return s -} - -// SetBitOrder sets the BitOrder field's value. -func (s *AudioCodecOptions) SetBitOrder(v string) *AudioCodecOptions { - s.BitOrder = &v - return s -} - -// SetProfile sets the Profile field's value. -func (s *AudioCodecOptions) SetProfile(v string) *AudioCodecOptions { - s.Profile = &v - return s -} - -// SetSigned sets the Signed field's value. -func (s *AudioCodecOptions) SetSigned(v string) *AudioCodecOptions { - s.Signed = &v - return s -} - -// Parameters required for transcoding audio. -type AudioParameters struct { - _ struct{} `type:"structure"` - - // The method of organizing audio channels and tracks. Use Audio:Channels to - // specify the number of channels in your output, and Audio:AudioPackingMode - // to specify the number of tracks and their relation to the channels. If you - // do not specify an Audio:AudioPackingMode, Elastic Transcoder uses SingleTrack. - // - // The following values are valid: - // - // SingleTrack, OneChannelPerTrack, and OneChannelPerTrackWithMosTo8Tracks - // - // When you specify SingleTrack, Elastic Transcoder creates a single track for - // your output. The track can have up to eight channels. Use SingleTrack for - // all non-mxf containers. - // - // The outputs of SingleTrack for a specific channel value and inputs are as - // follows: - // - // * 0 channels with any input: Audio omitted from the output - // - // * 1, 2, or auto channels with no audio input: Audio omitted from the output - // - // * 1 channel with any input with audio: One track with one channel, downmixed - // if necessary - // - // * 2 channels with one track with one channel: One track with two identical - // channels - // - // * 2 or auto channels with two tracks with one channel each: One track - // with two channels - // - // * 2 or auto channels with one track with two channels: One track with - // two channels - // - // * 2 channels with one track with multiple channels: One track with two - // channels - // - // * auto channels with one track with one channel: One track with one channel - // - // * auto channels with one track with multiple channels: One track with - // multiple channels - // - // When you specify OneChannelPerTrack, Elastic Transcoder creates a new track - // for every channel in your output. Your output can have up to eight single-channel - // tracks. - // - // The outputs of OneChannelPerTrack for a specific channel value and inputs - // are as follows: - // - // * 0 channels with any input: Audio omitted from the output - // - // * 1, 2, or auto channels with no audio input: Audio omitted from the output - // - // * 1 channel with any input with audio: One track with one channel, downmixed - // if necessary - // - // * 2 channels with one track with one channel: Two tracks with one identical - // channel each - // - // * 2 or auto channels with two tracks with one channel each: Two tracks - // with one channel each - // - // * 2 or auto channels with one track with two channels: Two tracks with - // one channel each - // - // * 2 channels with one track with multiple channels: Two tracks with one - // channel each - // - // * auto channels with one track with one channel: One track with one channel - // - // * auto channels with one track with multiple channels: Up to eight tracks - // with one channel each - // - // When you specify OneChannelPerTrackWithMosTo8Tracks, Elastic Transcoder creates - // eight single-channel tracks for your output. All tracks that do not contain - // audio data from an input channel are MOS, or Mit Out Sound, tracks. - // - // The outputs of OneChannelPerTrackWithMosTo8Tracks for a specific channel - // value and inputs are as follows: - // - // * 0 channels with any input: Audio omitted from the output - // - // * 1, 2, or auto channels with no audio input: Audio omitted from the output - // - // * 1 channel with any input with audio: One track with one channel, downmixed - // if necessary, plus six MOS tracks - // - // * 2 channels with one track with one channel: Two tracks with one identical - // channel each, plus six MOS tracks - // - // * 2 or auto channels with two tracks with one channel each: Two tracks - // with one channel each, plus six MOS tracks - // - // * 2 or auto channels with one track with two channels: Two tracks with - // one channel each, plus six MOS tracks - // - // * 2 channels with one track with multiple channels: Two tracks with one - // channel each, plus six MOS tracks - // - // * auto channels with one track with one channel: One track with one channel, - // plus seven MOS tracks - // - // * auto channels with one track with multiple channels: Up to eight tracks - // with one channel each, plus MOS tracks until there are eight tracks in - // all - AudioPackingMode *string `type:"string"` - - // The bit rate of the audio stream in the output file, in kilobits/second. - // Enter an integer between 64 and 320, inclusive. - BitRate *string `type:"string"` - - // The number of audio channels in the output file. The following values are - // valid: - // - // auto, 0, 1, 2 - // - // One channel carries the information played by a single speaker. For example, - // a stereo track with two channels sends one channel to the left speaker, and - // the other channel to the right speaker. The output channels are organized - // into tracks. If you want Elastic Transcoder to automatically detect the number - // of audio channels in the input file and use that value for the output file, - // select auto. - // - // The output of a specific channel value and inputs are as follows: - // - // * auto channel specified, with any input: Pass through up to eight input - // channels. - // - // * 0 channels specified, with any input: Audio omitted from the output. - // - // * 1 channel specified, with at least one input channel: Mono sound. - // - // * 2 channels specified, with any input: Two identical mono channels or - // stereo. For more information about tracks, see Audio:AudioPackingMode. - // - // For more information about how Elastic Transcoder organizes channels and - // tracks, see Audio:AudioPackingMode. - Channels *string `type:"string"` - - // The audio codec for the output file. Valid values include aac, flac, mp2, - // mp3, pcm, and vorbis. - Codec *string `type:"string"` - - // If you specified AAC for Audio:Codec, this is the AAC compression profile - // to use. Valid values include: - // - // auto, AAC-LC, HE-AAC, HE-AACv2 - // - // If you specify auto, Elastic Transcoder chooses a profile based on the bit - // rate of the output file. - CodecOptions *AudioCodecOptions `type:"structure"` - - // The sample rate of the audio stream in the output file, in Hertz. Valid values - // include: - // - // auto, 22050, 32000, 44100, 48000, 96000 - // - // If you specify auto, Elastic Transcoder automatically detects the sample - // rate. - SampleRate *string `type:"string"` -} - -// String returns the string representation -func (s AudioParameters) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AudioParameters) GoString() string { - return s.String() -} - -// SetAudioPackingMode sets the AudioPackingMode field's value. -func (s *AudioParameters) SetAudioPackingMode(v string) *AudioParameters { - s.AudioPackingMode = &v - return s -} - -// SetBitRate sets the BitRate field's value. -func (s *AudioParameters) SetBitRate(v string) *AudioParameters { - s.BitRate = &v - return s -} - -// SetChannels sets the Channels field's value. -func (s *AudioParameters) SetChannels(v string) *AudioParameters { - s.Channels = &v - return s -} - -// SetCodec sets the Codec field's value. -func (s *AudioParameters) SetCodec(v string) *AudioParameters { - s.Codec = &v - return s -} - -// SetCodecOptions sets the CodecOptions field's value. -func (s *AudioParameters) SetCodecOptions(v *AudioCodecOptions) *AudioParameters { - s.CodecOptions = v - return s -} - -// SetSampleRate sets the SampleRate field's value. -func (s *AudioParameters) SetSampleRate(v string) *AudioParameters { - s.SampleRate = &v - return s -} - -// The CancelJobRequest structure. -type CancelJobInput struct { - _ struct{} `type:"structure"` - - // The identifier of the job that you want to cancel. - // - // To get a list of the jobs (including their jobId) that have a status of Submitted, - // use the ListJobsByStatus API action. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` -} - -// String returns the string representation -func (s CancelJobInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CancelJobInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CancelJobInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CancelJobInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *CancelJobInput) SetId(v string) *CancelJobInput { - s.Id = &v - return s -} - -// The response body contains a JSON object. If the job is successfully canceled, -// the value of Success is true. -type CancelJobOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s CancelJobOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CancelJobOutput) GoString() string { - return s.String() -} - -// The file format of the output captions. If you leave this value blank, Elastic -// Transcoder returns an error. -type CaptionFormat struct { - _ struct{} `type:"structure"` - - // The encryption settings, if any, that you want Elastic Transcoder to apply - // to your caption formats. - Encryption *Encryption `type:"structure"` - - // The format you specify determines whether Elastic Transcoder generates an - // embedded or sidecar caption for this output. - // - // * Valid Embedded Caption Formats: - // - // for FLAC: None - // - // For MP3: None - // - // For MP4: mov-text - // - // For MPEG-TS: None - // - // For ogg: None - // - // For webm: None - // - // * Valid Sidecar Caption Formats: Elastic Transcoder supports dfxp (first - // div element only), scc, srt, and webvtt. If you want ttml or smpte-tt - // compatible captions, specify dfxp as your output format. - // - // For FMP4: dfxp - // - // Non-FMP4 outputs: All sidecar types - // - // fmp4 captions have an extension of .ismt - Format *string `type:"string"` - - // The prefix for caption filenames, in the form description-{language}, where: - // - // * description is a description of the video. - // - // * {language} is a literal value that Elastic Transcoder replaces with - // the two- or three-letter code for the language of the caption in the output - // file names. - // - // If you don't include {language} in the file name pattern, Elastic Transcoder - // automatically appends "{language}" to the value that you specify for the - // description. In addition, Elastic Transcoder automatically appends the count - // to the end of the segment files. - // - // For example, suppose you're transcoding into srt format. When you enter "Sydney-{language}-sunrise", - // and the language of the captions is English (en), the name of the first caption - // file is be Sydney-en-sunrise00000.srt. - Pattern *string `type:"string"` -} - -// String returns the string representation -func (s CaptionFormat) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CaptionFormat) GoString() string { - return s.String() -} - -// SetEncryption sets the Encryption field's value. -func (s *CaptionFormat) SetEncryption(v *Encryption) *CaptionFormat { - s.Encryption = v - return s -} - -// SetFormat sets the Format field's value. -func (s *CaptionFormat) SetFormat(v string) *CaptionFormat { - s.Format = &v - return s -} - -// SetPattern sets the Pattern field's value. -func (s *CaptionFormat) SetPattern(v string) *CaptionFormat { - s.Pattern = &v - return s -} - -// A source file for the input sidecar captions used during the transcoding -// process. -type CaptionSource struct { - _ struct{} `type:"structure"` - - // The encryption settings, if any, that Elastic Transcoder needs to decyrpt - // your caption sources, or that you want Elastic Transcoder to apply to your - // caption sources. - Encryption *Encryption `type:"structure"` - - // The name of the sidecar caption file that you want Elastic Transcoder to - // include in the output file. - Key *string `min:"1" type:"string"` - - // The label of the caption shown in the player when choosing a language. We - // recommend that you put the caption language name here, in the language of - // the captions. - Label *string `min:"1" type:"string"` - - // A string that specifies the language of the caption. If you specified multiple - // inputs with captions, the caption language must match in order to be included - // in the output. Specify this as one of: - // - // * 2-character ISO 639-1 code - // - // * 3-character ISO 639-2 code - // - // For more information on ISO language codes and language names, see the List - // of ISO 639-1 codes. - Language *string `min:"1" type:"string"` - - // For clip generation or captions that do not start at the same time as the - // associated video file, the TimeOffset tells Elastic Transcoder how much of - // the video to encode before including captions. - // - // Specify the TimeOffset in the form [+-]SS.sss or [+-]HH:mm:SS.ss. - TimeOffset *string `type:"string"` -} - -// String returns the string representation -func (s CaptionSource) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CaptionSource) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CaptionSource) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CaptionSource"} - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.Label != nil && len(*s.Label) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Label", 1)) - } - if s.Language != nil && len(*s.Language) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Language", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryption sets the Encryption field's value. -func (s *CaptionSource) SetEncryption(v *Encryption) *CaptionSource { - s.Encryption = v - return s -} - -// SetKey sets the Key field's value. -func (s *CaptionSource) SetKey(v string) *CaptionSource { - s.Key = &v - return s -} - -// SetLabel sets the Label field's value. -func (s *CaptionSource) SetLabel(v string) *CaptionSource { - s.Label = &v - return s -} - -// SetLanguage sets the Language field's value. -func (s *CaptionSource) SetLanguage(v string) *CaptionSource { - s.Language = &v - return s -} - -// SetTimeOffset sets the TimeOffset field's value. -func (s *CaptionSource) SetTimeOffset(v string) *CaptionSource { - s.TimeOffset = &v - return s -} - -// The captions to be created, if any. -type Captions struct { - _ struct{} `type:"structure"` - - // The array of file formats for the output captions. If you leave this value - // blank, Elastic Transcoder returns an error. - CaptionFormats []*CaptionFormat `type:"list"` - - // Source files for the input sidecar captions used during the transcoding process. - // To omit all sidecar captions, leave CaptionSources blank. - CaptionSources []*CaptionSource `deprecated:"true" type:"list"` - - // A policy that determines how Elastic Transcoder handles the existence of - // multiple captions. - // - // * MergeOverride: Elastic Transcoder transcodes both embedded and sidecar - // captions into outputs. If captions for a language are embedded in the - // input file and also appear in a sidecar file, Elastic Transcoder uses - // the sidecar captions and ignores the embedded captions for that language. - // - // * MergeRetain: Elastic Transcoder transcodes both embedded and sidecar - // captions into outputs. If captions for a language are embedded in the - // input file and also appear in a sidecar file, Elastic Transcoder uses - // the embedded captions and ignores the sidecar captions for that language. - // If CaptionSources is empty, Elastic Transcoder omits all sidecar captions - // from the output files. - // - // * Override: Elastic Transcoder transcodes only the sidecar captions that - // you specify in CaptionSources. - // - // MergePolicy cannot be null. - MergePolicy *string `deprecated:"true" type:"string"` -} - -// String returns the string representation -func (s Captions) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Captions) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Captions) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Captions"} - if s.CaptionSources != nil { - for i, v := range s.CaptionSources { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CaptionSources", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCaptionFormats sets the CaptionFormats field's value. -func (s *Captions) SetCaptionFormats(v []*CaptionFormat) *Captions { - s.CaptionFormats = v - return s -} - -// SetCaptionSources sets the CaptionSources field's value. -func (s *Captions) SetCaptionSources(v []*CaptionSource) *Captions { - s.CaptionSources = v - return s -} - -// SetMergePolicy sets the MergePolicy field's value. -func (s *Captions) SetMergePolicy(v string) *Captions { - s.MergePolicy = &v - return s -} - -// Settings for one clip in a composition. All jobs in a playlist must have -// the same clip settings. -type Clip struct { - _ struct{} `deprecated:"true" type:"structure"` - - // Settings that determine when a clip begins and how long it lasts. - TimeSpan *TimeSpan `type:"structure"` -} - -// String returns the string representation -func (s Clip) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Clip) GoString() string { - return s.String() -} - -// SetTimeSpan sets the TimeSpan field's value. -func (s *Clip) SetTimeSpan(v *TimeSpan) *Clip { - s.TimeSpan = v - return s -} - -// The CreateJobRequest structure. -type CreateJobInput struct { - _ struct{} `type:"structure"` - - // A section of the request body that provides information about the file that - // is being transcoded. - Input *JobInput `type:"structure"` - - // A section of the request body that provides information about the files that - // are being transcoded. - Inputs []*JobInput `type:"list"` - - // A section of the request body that provides information about the transcoded - // (target) file. We strongly recommend that you use the Outputs syntax instead - // of the Output syntax. - Output *CreateJobOutput `type:"structure"` - - // The value, if any, that you want Elastic Transcoder to prepend to the names - // of all files that this job creates, including output files, thumbnails, and - // playlists. - OutputKeyPrefix *string `min:"1" type:"string"` - - // A section of the request body that provides information about the transcoded - // (target) files. We recommend that you use the Outputs syntax instead of the - // Output syntax. - Outputs []*CreateJobOutput `type:"list"` - - // The Id of the pipeline that you want Elastic Transcoder to use for transcoding. - // The pipeline determines several settings, including the Amazon S3 bucket - // from which Elastic Transcoder gets the files to transcode and the bucket - // into which Elastic Transcoder puts the transcoded files. - // - // PipelineId is a required field - PipelineId *string `type:"string" required:"true"` - - // If you specify a preset in PresetId for which the value of Container is fmp4 - // (Fragmented MP4) or ts (MPEG-TS), Playlists contains information about the - // master playlists that you want Elastic Transcoder to create. - // - // The maximum number of master playlists in a job is 30. - Playlists []*CreateJobPlaylist `type:"list"` - - // User-defined metadata that you want to associate with an Elastic Transcoder - // job. You specify metadata in key/value pairs, and you can add up to 10 key/value - // pairs per job. Elastic Transcoder does not guarantee that key/value pairs - // are returned in the same order in which you specify them. - UserMetadata map[string]*string `type:"map"` -} - -// String returns the string representation -func (s CreateJobInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateJobInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateJobInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateJobInput"} - if s.OutputKeyPrefix != nil && len(*s.OutputKeyPrefix) < 1 { - invalidParams.Add(request.NewErrParamMinLen("OutputKeyPrefix", 1)) - } - if s.PipelineId == nil { - invalidParams.Add(request.NewErrParamRequired("PipelineId")) - } - if s.Input != nil { - if err := s.Input.Validate(); err != nil { - invalidParams.AddNested("Input", err.(request.ErrInvalidParams)) - } - } - if s.Inputs != nil { - for i, v := range s.Inputs { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Inputs", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Output != nil { - if err := s.Output.Validate(); err != nil { - invalidParams.AddNested("Output", err.(request.ErrInvalidParams)) - } - } - if s.Outputs != nil { - for i, v := range s.Outputs { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Outputs", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Playlists != nil { - for i, v := range s.Playlists { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Playlists", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInput sets the Input field's value. -func (s *CreateJobInput) SetInput(v *JobInput) *CreateJobInput { - s.Input = v - return s -} - -// SetInputs sets the Inputs field's value. -func (s *CreateJobInput) SetInputs(v []*JobInput) *CreateJobInput { - s.Inputs = v - return s -} - -// SetOutput sets the Output field's value. -func (s *CreateJobInput) SetOutput(v *CreateJobOutput) *CreateJobInput { - s.Output = v - return s -} - -// SetOutputKeyPrefix sets the OutputKeyPrefix field's value. -func (s *CreateJobInput) SetOutputKeyPrefix(v string) *CreateJobInput { - s.OutputKeyPrefix = &v - return s -} - -// SetOutputs sets the Outputs field's value. -func (s *CreateJobInput) SetOutputs(v []*CreateJobOutput) *CreateJobInput { - s.Outputs = v - return s -} - -// SetPipelineId sets the PipelineId field's value. -func (s *CreateJobInput) SetPipelineId(v string) *CreateJobInput { - s.PipelineId = &v - return s -} - -// SetPlaylists sets the Playlists field's value. -func (s *CreateJobInput) SetPlaylists(v []*CreateJobPlaylist) *CreateJobInput { - s.Playlists = v - return s -} - -// SetUserMetadata sets the UserMetadata field's value. -func (s *CreateJobInput) SetUserMetadata(v map[string]*string) *CreateJobInput { - s.UserMetadata = v - return s -} - -// The CreateJobOutput structure. -type CreateJobOutput struct { - _ struct{} `type:"structure"` - - // Information about the album art that you want Elastic Transcoder to add to - // the file during transcoding. You can specify up to twenty album artworks - // for each output. Settings for each artwork must be defined in the job for - // the current output. - AlbumArt *JobAlbumArt `type:"structure"` - - // You can configure Elastic Transcoder to transcode captions, or subtitles, - // from one format to another. All captions must be in UTF-8. Elastic Transcoder - // supports two types of captions: - // - // * Embedded: Embedded captions are included in the same file as the audio - // and video. Elastic Transcoder supports only one embedded caption per language, - // to a maximum of 300 embedded captions per file. - // - // Valid input values include: CEA-608 (EIA-608, first non-empty channel only), - // CEA-708 (EIA-708, first non-empty channel only), and mov-text - // - // Valid outputs include: mov-text - // - // Elastic Transcoder supports a maximum of one embedded format per output. - // - // * Sidecar: Sidecar captions are kept in a separate metadata file from - // the audio and video data. Sidecar captions require a player that is capable - // of understanding the relationship between the video file and the sidecar - // file. Elastic Transcoder supports only one sidecar caption per language, - // to a maximum of 20 sidecar captions per file. - // - // Valid input values include: dfxp (first div element only), ebu-tt, scc, smpt, - // srt, ttml (first div element only), and webvtt - // - // Valid outputs include: dfxp (first div element only), scc, srt, and webvtt. - // - // If you want ttml or smpte-tt compatible captions, specify dfxp as your output - // format. - // - // Elastic Transcoder does not support OCR (Optical Character Recognition), - // does not accept pictures as a valid input for captions, and is not available - // for audio-only transcoding. Elastic Transcoder does not preserve text formatting - // (for example, italics) during the transcoding process. - // - // To remove captions or leave the captions empty, set Captions to null. To - // pass through existing captions unchanged, set the MergePolicy to MergeRetain, - // and pass in a null CaptionSources array. - // - // For more information on embedded files, see the Subtitles Wikipedia page. - // - // For more information on sidecar files, see the Extensible Metadata Platform - // and Sidecar file Wikipedia pages. - Captions *Captions `type:"structure"` - - // You can create an output file that contains an excerpt from the input file. - // This excerpt, called a clip, can come from the beginning, middle, or end - // of the file. The Composition object contains settings for the clips that - // make up an output file. For the current release, you can only specify settings - // for a single clip per output file. The Composition object cannot be null. - Composition []*Clip `deprecated:"true" type:"list"` - - // You can specify encryption settings for any output files that you want to - // use for a transcoding job. This includes the output file and any watermarks, - // thumbnails, album art, or captions that you want to use. You must specify - // encryption settings for each file individually. - Encryption *Encryption `type:"structure"` - - // The name to assign to the transcoded file. Elastic Transcoder saves the file - // in the Amazon S3 bucket specified by the OutputBucket object in the pipeline - // that is specified by the pipeline ID. If a file with the specified name already - // exists in the output bucket, the job fails. - Key *string `min:"1" type:"string"` - - // The Id of the preset to use for this job. The preset determines the audio, - // video, and thumbnail settings that Elastic Transcoder uses for transcoding. - PresetId *string `type:"string"` - - // The number of degrees clockwise by which you want Elastic Transcoder to rotate - // the output relative to the input. Enter one of the following values: auto, - // 0, 90, 180, 270. The value auto generally works only if the file that you're - // transcoding contains rotation metadata. - Rotate *string `type:"string"` - - // (Outputs in Fragmented MP4 or MPEG-TS format only. - // - // If you specify a preset in PresetId for which the value of Container is fmp4 - // (Fragmented MP4) or ts (MPEG-TS), SegmentDuration is the target maximum duration - // of each segment in seconds. For HLSv3 format playlists, each media segment - // is stored in a separate .ts file. For HLSv4 and Smooth playlists, all media - // segments for an output are stored in a single file. Each segment is approximately - // the length of the SegmentDuration, though individual segments might be shorter - // or longer. - // - // The range of valid values is 1 to 60 seconds. If the duration of the video - // is not evenly divisible by SegmentDuration, the duration of the last segment - // is the remainder of total length/SegmentDuration. - // - // Elastic Transcoder creates an output-specific playlist for each output HLS - // output that you specify in OutputKeys. To add an output to the master playlist - // for this job, include it in the OutputKeys of the associated playlist. - SegmentDuration *string `type:"string"` - - // The encryption settings, if any, that you want Elastic Transcoder to apply - // to your thumbnail. - ThumbnailEncryption *Encryption `type:"structure"` - - // Whether you want Elastic Transcoder to create thumbnails for your videos - // and, if so, how you want Elastic Transcoder to name the files. - // - // If you don't want Elastic Transcoder to create thumbnails, specify "". - // - // If you do want Elastic Transcoder to create thumbnails, specify the information - // that you want to include in the file name for each thumbnail. You can specify - // the following values in any sequence: - // - // * {count} (Required): If you want to create thumbnails, you must include - // {count} in the ThumbnailPattern object. Wherever you specify {count}, - // Elastic Transcoder adds a five-digit sequence number (beginning with 00001) - // to thumbnail file names. The number indicates where a given thumbnail - // appears in the sequence of thumbnails for a transcoded file. - // - // If you specify a literal value and/or {resolution} but you omit {count}, - // Elastic Transcoder returns a validation error and does not create the - // job. - // - // * Literal values (Optional): You can specify literal values anywhere in - // the ThumbnailPattern object. For example, you can include them as a file - // name prefix or as a delimiter between {resolution} and {count}. - // - // * {resolution} (Optional): If you want Elastic Transcoder to include the - // resolution in the file name, include {resolution} in the ThumbnailPattern - // object. - // - // When creating thumbnails, Elastic Transcoder automatically saves the files - // in the format (.jpg or .png) that appears in the preset that you specified - // in the PresetID value of CreateJobOutput. Elastic Transcoder also appends - // the applicable file name extension. - ThumbnailPattern *string `type:"string"` - - // Information about the watermarks that you want Elastic Transcoder to add - // to the video during transcoding. You can specify up to four watermarks for - // each output. Settings for each watermark must be defined in the preset for - // the current output. - Watermarks []*JobWatermark `type:"list"` -} - -// String returns the string representation -func (s CreateJobOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateJobOutput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateJobOutput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateJobOutput"} - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.AlbumArt != nil { - if err := s.AlbumArt.Validate(); err != nil { - invalidParams.AddNested("AlbumArt", err.(request.ErrInvalidParams)) - } - } - if s.Captions != nil { - if err := s.Captions.Validate(); err != nil { - invalidParams.AddNested("Captions", err.(request.ErrInvalidParams)) - } - } - if s.Watermarks != nil { - for i, v := range s.Watermarks { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Watermarks", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAlbumArt sets the AlbumArt field's value. -func (s *CreateJobOutput) SetAlbumArt(v *JobAlbumArt) *CreateJobOutput { - s.AlbumArt = v - return s -} - -// SetCaptions sets the Captions field's value. -func (s *CreateJobOutput) SetCaptions(v *Captions) *CreateJobOutput { - s.Captions = v - return s -} - -// SetComposition sets the Composition field's value. -func (s *CreateJobOutput) SetComposition(v []*Clip) *CreateJobOutput { - s.Composition = v - return s -} - -// SetEncryption sets the Encryption field's value. -func (s *CreateJobOutput) SetEncryption(v *Encryption) *CreateJobOutput { - s.Encryption = v - return s -} - -// SetKey sets the Key field's value. -func (s *CreateJobOutput) SetKey(v string) *CreateJobOutput { - s.Key = &v - return s -} - -// SetPresetId sets the PresetId field's value. -func (s *CreateJobOutput) SetPresetId(v string) *CreateJobOutput { - s.PresetId = &v - return s -} - -// SetRotate sets the Rotate field's value. -func (s *CreateJobOutput) SetRotate(v string) *CreateJobOutput { - s.Rotate = &v - return s -} - -// SetSegmentDuration sets the SegmentDuration field's value. -func (s *CreateJobOutput) SetSegmentDuration(v string) *CreateJobOutput { - s.SegmentDuration = &v - return s -} - -// SetThumbnailEncryption sets the ThumbnailEncryption field's value. -func (s *CreateJobOutput) SetThumbnailEncryption(v *Encryption) *CreateJobOutput { - s.ThumbnailEncryption = v - return s -} - -// SetThumbnailPattern sets the ThumbnailPattern field's value. -func (s *CreateJobOutput) SetThumbnailPattern(v string) *CreateJobOutput { - s.ThumbnailPattern = &v - return s -} - -// SetWatermarks sets the Watermarks field's value. -func (s *CreateJobOutput) SetWatermarks(v []*JobWatermark) *CreateJobOutput { - s.Watermarks = v - return s -} - -// Information about the master playlist. -type CreateJobPlaylist struct { - _ struct{} `type:"structure"` - - // The format of the output playlist. Valid formats include HLSv3, HLSv4, and - // Smooth. - Format *string `type:"string"` - - // The HLS content protection settings, if any, that you want Elastic Transcoder - // to apply to the output files associated with this playlist. - HlsContentProtection *HlsContentProtection `type:"structure"` - - // The name that you want Elastic Transcoder to assign to the master playlist, - // for example, nyc-vacation.m3u8. If the name includes a / character, the section - // of the name before the last / must be identical for all Name objects. If - // you create more than one master playlist, the values of all Name objects - // must be unique. - // - // Elastic Transcoder automatically appends the relevant file extension to the - // file name (.m3u8 for HLSv3 and HLSv4 playlists, and .ism and .ismc for Smooth - // playlists). If you include a file extension in Name, the file name will have - // two extensions. - Name *string `min:"1" type:"string"` - - // For each output in this job that you want to include in a master playlist, - // the value of the Outputs:Key object. - // - // * If your output is not HLS or does not have a segment duration set, the - // name of the output file is a concatenation of OutputKeyPrefix and Outputs:Key: - // - // OutputKeyPrefixOutputs:Key - // - // * If your output is HLSv3 and has a segment duration set, or is not included - // in a playlist, Elastic Transcoder creates an output playlist file with - // a file extension of .m3u8, and a series of .ts files that include a five-digit - // sequential counter beginning with 00000: - // - // OutputKeyPrefixOutputs:Key.m3u8 - // - // OutputKeyPrefixOutputs:Key00000.ts - // - // * If your output is HLSv4, has a segment duration set, and is included - // in an HLSv4 playlist, Elastic Transcoder creates an output playlist file - // with a file extension of _v4.m3u8. If the output is video, Elastic Transcoder - // also creates an output file with an extension of _iframe.m3u8: - // - // OutputKeyPrefixOutputs:Key_v4.m3u8 - // - // OutputKeyPrefixOutputs:Key_iframe.m3u8 - // - // OutputKeyPrefixOutputs:Key.ts - // - // Elastic Transcoder automatically appends the relevant file extension to the - // file name. If you include a file extension in Output Key, the file name will - // have two extensions. - // - // If you include more than one output in a playlist, any segment duration settings, - // clip settings, or caption settings must be the same for all outputs in the - // playlist. For Smooth playlists, the Audio:Profile, Video:Profile, and Video:FrameRate - // to Video:KeyframesMaxDist ratio must be the same for all outputs. - OutputKeys []*string `type:"list"` - - // The DRM settings, if any, that you want Elastic Transcoder to apply to the - // output files associated with this playlist. - PlayReadyDrm *PlayReadyDrm `type:"structure"` -} - -// String returns the string representation -func (s CreateJobPlaylist) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateJobPlaylist) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateJobPlaylist) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateJobPlaylist"} - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } - if s.PlayReadyDrm != nil { - if err := s.PlayReadyDrm.Validate(); err != nil { - invalidParams.AddNested("PlayReadyDrm", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFormat sets the Format field's value. -func (s *CreateJobPlaylist) SetFormat(v string) *CreateJobPlaylist { - s.Format = &v - return s -} - -// SetHlsContentProtection sets the HlsContentProtection field's value. -func (s *CreateJobPlaylist) SetHlsContentProtection(v *HlsContentProtection) *CreateJobPlaylist { - s.HlsContentProtection = v - return s -} - -// SetName sets the Name field's value. -func (s *CreateJobPlaylist) SetName(v string) *CreateJobPlaylist { - s.Name = &v - return s -} - -// SetOutputKeys sets the OutputKeys field's value. -func (s *CreateJobPlaylist) SetOutputKeys(v []*string) *CreateJobPlaylist { - s.OutputKeys = v - return s -} - -// SetPlayReadyDrm sets the PlayReadyDrm field's value. -func (s *CreateJobPlaylist) SetPlayReadyDrm(v *PlayReadyDrm) *CreateJobPlaylist { - s.PlayReadyDrm = v - return s -} - -// The CreateJobResponse structure. -type CreateJobResponse struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the job that - // is created. - Job *Job `type:"structure"` -} - -// String returns the string representation -func (s CreateJobResponse) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateJobResponse) GoString() string { - return s.String() -} - -// SetJob sets the Job field's value. -func (s *CreateJobResponse) SetJob(v *Job) *CreateJobResponse { - s.Job = v - return s -} - -// The CreatePipelineRequest structure. -type CreatePipelineInput struct { - _ struct{} `type:"structure"` - - // The AWS Key Management Service (AWS KMS) key that you want to use with this - // pipeline. - // - // If you use either S3 or S3-AWS-KMS as your Encryption:Mode, you don't need - // to provide a key with your job because a default key, known as an AWS-KMS - // key, is created for you automatically. You need to provide an AWS-KMS key - // only if you want to use a non-default AWS-KMS key, or if you are using an - // Encryption:Mode of AES-PKCS7, AES-CTR, or AES-GCM. - AwsKmsKeyArn *string `type:"string"` - - // The optional ContentConfig object specifies information about the Amazon - // S3 bucket in which you want Elastic Transcoder to save transcoded files and - // playlists: which bucket to use, which users you want to have access to the - // files, the type of access you want users to have, and the storage class that - // you want to assign to the files. - // - // If you specify values for ContentConfig, you must also specify values for - // ThumbnailConfig. - // - // If you specify values for ContentConfig and ThumbnailConfig, omit the OutputBucket - // object. - // - // * Bucket: The Amazon S3 bucket in which you want Elastic Transcoder to - // save transcoded files and playlists. - // - // * Permissions (Optional): The Permissions object specifies which users - // you want to have access to transcoded files and the type of access you - // want them to have. You can grant permissions to a maximum of 30 users - // and/or predefined Amazon S3 groups. - // - // * Grantee Type: Specify the type of value that appears in the Grantee - // object: - // - // Canonical: The value in the Grantee object is either the canonical user ID - // for an AWS account or an origin access identity for an Amazon CloudFront - // distribution. For more information about canonical user IDs, see Access - // Control List (ACL) Overview in the Amazon Simple Storage Service Developer - // Guide. For more information about using CloudFront origin access identities - // to require that users use CloudFront URLs instead of Amazon S3 URLs, see - // Using an Origin Access Identity to Restrict Access to Your Amazon S3 Content. - // - // A canonical user ID is not the same as an AWS account number. - // - // Email: The value in the Grantee object is the registered email address of - // an AWS account. - // - // Group: The value in the Grantee object is one of the following predefined - // Amazon S3 groups: AllUsers, AuthenticatedUsers, or LogDelivery. - // - // * Grantee: The AWS user or group that you want to have access to transcoded - // files and playlists. To identify the user or group, you can specify the - // canonical user ID for an AWS account, an origin access identity for a - // CloudFront distribution, the registered email address of an AWS account, - // or a predefined Amazon S3 group - // - // * Access: The permission that you want to give to the AWS user that you - // specified in Grantee. Permissions are granted on the files that Elastic - // Transcoder adds to the bucket, including playlists and video files. Valid - // values include: - // - // READ: The grantee can read the objects and metadata for objects that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // READ_ACP: The grantee can read the object ACL for objects that Elastic Transcoder - // adds to the Amazon S3 bucket. - // - // WRITE_ACP: The grantee can write the ACL for the objects that Elastic Transcoder - // adds to the Amazon S3 bucket. - // - // FULL_CONTROL: The grantee has READ, READ_ACP, and WRITE_ACP permissions for - // the objects that Elastic Transcoder adds to the Amazon S3 bucket. - // - // * StorageClass: The Amazon S3 storage class, Standard or ReducedRedundancy, - // that you want Elastic Transcoder to assign to the video files and playlists - // that it stores in your Amazon S3 bucket. - ContentConfig *PipelineOutputConfig `type:"structure"` - - // The Amazon S3 bucket in which you saved the media files that you want to - // transcode. - // - // InputBucket is a required field - InputBucket *string `type:"string" required:"true"` - - // The name of the pipeline. We recommend that the name be unique within the - // AWS account, but uniqueness is not enforced. - // - // Constraints: Maximum 40 characters. - // - // Name is a required field - Name *string `min:"1" type:"string" required:"true"` - - // The Amazon Simple Notification Service (Amazon SNS) topic that you want to - // notify to report job status. - // - // To receive notifications, you must also subscribe to the new topic in the - // Amazon SNS console. - // - // * Progressing: The topic ARN for the Amazon Simple Notification Service - // (Amazon SNS) topic that you want to notify when Elastic Transcoder has - // started to process a job in this pipeline. This is the ARN that Amazon - // SNS returned when you created the topic. For more information, see Create - // a Topic in the Amazon Simple Notification Service Developer Guide. - // - // * Completed: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder has finished processing a job in this pipeline. - // This is the ARN that Amazon SNS returned when you created the topic. - // - // * Warning: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder encounters a warning condition while processing - // a job in this pipeline. This is the ARN that Amazon SNS returned when - // you created the topic. - // - // * Error: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder encounters an error condition while processing - // a job in this pipeline. This is the ARN that Amazon SNS returned when - // you created the topic. - Notifications *Notifications `type:"structure"` - - // The Amazon S3 bucket in which you want Elastic Transcoder to save the transcoded - // files. (Use this, or use ContentConfig:Bucket plus ThumbnailConfig:Bucket.) - // - // Specify this value when all of the following are true: - // - // * You want to save transcoded files, thumbnails (if any), and playlists - // (if any) together in one bucket. - // - // * You do not want to specify the users or groups who have access to the - // transcoded files, thumbnails, and playlists. - // - // * You do not want to specify the permissions that Elastic Transcoder grants - // to the files. - // - // When Elastic Transcoder saves files in OutputBucket, it grants full control - // over the files only to the AWS account that owns the role that is specified - // by Role. - // - // * You want to associate the transcoded files and thumbnails with the Amazon - // S3 Standard storage class. - // - // If you want to save transcoded files and playlists in one bucket and thumbnails - // in another bucket, specify which users can access the transcoded files or - // the permissions the users have, or change the Amazon S3 storage class, omit - // OutputBucket and specify values for ContentConfig and ThumbnailConfig instead. - OutputBucket *string `type:"string"` - - // The IAM Amazon Resource Name (ARN) for the role that you want Elastic Transcoder - // to use to create the pipeline. - // - // Role is a required field - Role *string `type:"string" required:"true"` - - // The ThumbnailConfig object specifies several values, including the Amazon - // S3 bucket in which you want Elastic Transcoder to save thumbnail files, which - // users you want to have access to the files, the type of access you want users - // to have, and the storage class that you want to assign to the files. - // - // If you specify values for ContentConfig, you must also specify values for - // ThumbnailConfig even if you don't want to create thumbnails. - // - // If you specify values for ContentConfig and ThumbnailConfig, omit the OutputBucket - // object. - // - // * Bucket: The Amazon S3 bucket in which you want Elastic Transcoder to - // save thumbnail files. - // - // * Permissions (Optional): The Permissions object specifies which users - // and/or predefined Amazon S3 groups you want to have access to thumbnail - // files, and the type of access you want them to have. You can grant permissions - // to a maximum of 30 users and/or predefined Amazon S3 groups. - // - // * GranteeType: Specify the type of value that appears in the Grantee object: - // - // - // Canonical: The value in the Grantee object is either the canonical user ID - // for an AWS account or an origin access identity for an Amazon CloudFront - // distribution. - // - // A canonical user ID is not the same as an AWS account number. - // - // Email: The value in the Grantee object is the registered email address of - // an AWS account. - // - // Group: The value in the Grantee object is one of the following predefined - // Amazon S3 groups: AllUsers, AuthenticatedUsers, or LogDelivery. - // - // * Grantee: The AWS user or group that you want to have access to thumbnail - // files. To identify the user or group, you can specify the canonical user - // ID for an AWS account, an origin access identity for a CloudFront distribution, - // the registered email address of an AWS account, or a predefined Amazon - // S3 group. - // - // * Access: The permission that you want to give to the AWS user that you - // specified in Grantee. Permissions are granted on the thumbnail files that - // Elastic Transcoder adds to the bucket. Valid values include: - // - // READ: The grantee can read the thumbnails and metadata for objects that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // READ_ACP: The grantee can read the object ACL for thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // WRITE_ACP: The grantee can write the ACL for the thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // FULL_CONTROL: The grantee has READ, READ_ACP, and WRITE_ACP permissions for - // the thumbnails that Elastic Transcoder adds to the Amazon S3 bucket. - // - // * StorageClass: The Amazon S3 storage class, Standard or ReducedRedundancy, - // that you want Elastic Transcoder to assign to the thumbnails that it stores - // in your Amazon S3 bucket. - ThumbnailConfig *PipelineOutputConfig `type:"structure"` -} - -// String returns the string representation -func (s CreatePipelineInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreatePipelineInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreatePipelineInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreatePipelineInput"} - if s.InputBucket == nil { - invalidParams.Add(request.NewErrParamRequired("InputBucket")) - } - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } - if s.Role == nil { - invalidParams.Add(request.NewErrParamRequired("Role")) - } - if s.ContentConfig != nil { - if err := s.ContentConfig.Validate(); err != nil { - invalidParams.AddNested("ContentConfig", err.(request.ErrInvalidParams)) - } - } - if s.ThumbnailConfig != nil { - if err := s.ThumbnailConfig.Validate(); err != nil { - invalidParams.AddNested("ThumbnailConfig", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAwsKmsKeyArn sets the AwsKmsKeyArn field's value. -func (s *CreatePipelineInput) SetAwsKmsKeyArn(v string) *CreatePipelineInput { - s.AwsKmsKeyArn = &v - return s -} - -// SetContentConfig sets the ContentConfig field's value. -func (s *CreatePipelineInput) SetContentConfig(v *PipelineOutputConfig) *CreatePipelineInput { - s.ContentConfig = v - return s -} - -// SetInputBucket sets the InputBucket field's value. -func (s *CreatePipelineInput) SetInputBucket(v string) *CreatePipelineInput { - s.InputBucket = &v - return s -} - -// SetName sets the Name field's value. -func (s *CreatePipelineInput) SetName(v string) *CreatePipelineInput { - s.Name = &v - return s -} - -// SetNotifications sets the Notifications field's value. -func (s *CreatePipelineInput) SetNotifications(v *Notifications) *CreatePipelineInput { - s.Notifications = v - return s -} - -// SetOutputBucket sets the OutputBucket field's value. -func (s *CreatePipelineInput) SetOutputBucket(v string) *CreatePipelineInput { - s.OutputBucket = &v - return s -} - -// SetRole sets the Role field's value. -func (s *CreatePipelineInput) SetRole(v string) *CreatePipelineInput { - s.Role = &v - return s -} - -// SetThumbnailConfig sets the ThumbnailConfig field's value. -func (s *CreatePipelineInput) SetThumbnailConfig(v *PipelineOutputConfig) *CreatePipelineInput { - s.ThumbnailConfig = v - return s -} - -// When you create a pipeline, Elastic Transcoder returns the values that you -// specified in the request. -type CreatePipelineOutput struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the pipeline - // that is created. - Pipeline *Pipeline `type:"structure"` - - // Elastic Transcoder returns a warning if the resources used by your pipeline - // are not in the same region as the pipeline. - // - // Using resources in the same region, such as your Amazon S3 buckets, Amazon - // SNS notification topics, and AWS KMS key, reduces processing time and prevents - // cross-regional charges. - Warnings []*Warning `type:"list"` -} - -// String returns the string representation -func (s CreatePipelineOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreatePipelineOutput) GoString() string { - return s.String() -} - -// SetPipeline sets the Pipeline field's value. -func (s *CreatePipelineOutput) SetPipeline(v *Pipeline) *CreatePipelineOutput { - s.Pipeline = v - return s -} - -// SetWarnings sets the Warnings field's value. -func (s *CreatePipelineOutput) SetWarnings(v []*Warning) *CreatePipelineOutput { - s.Warnings = v - return s -} - -// The CreatePresetRequest structure. -type CreatePresetInput struct { - _ struct{} `type:"structure"` - - // A section of the request body that specifies the audio parameters. - Audio *AudioParameters `type:"structure"` - - // The container type for the output file. Valid values include flac, flv, fmp4, - // gif, mp3, mp4, mpg, mxf, oga, ogg, ts, and webm. - // - // Container is a required field - Container *string `type:"string" required:"true"` - - // A description of the preset. - Description *string `type:"string"` - - // The name of the preset. We recommend that the name be unique within the AWS - // account, but uniqueness is not enforced. - // - // Name is a required field - Name *string `min:"1" type:"string" required:"true"` - - // A section of the request body that specifies the thumbnail parameters, if - // any. - Thumbnails *Thumbnails `type:"structure"` - - // A section of the request body that specifies the video parameters. - Video *VideoParameters `type:"structure"` -} - -// String returns the string representation -func (s CreatePresetInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreatePresetInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreatePresetInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreatePresetInput"} - if s.Container == nil { - invalidParams.Add(request.NewErrParamRequired("Container")) - } - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } - if s.Video != nil { - if err := s.Video.Validate(); err != nil { - invalidParams.AddNested("Video", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAudio sets the Audio field's value. -func (s *CreatePresetInput) SetAudio(v *AudioParameters) *CreatePresetInput { - s.Audio = v - return s -} - -// SetContainer sets the Container field's value. -func (s *CreatePresetInput) SetContainer(v string) *CreatePresetInput { - s.Container = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *CreatePresetInput) SetDescription(v string) *CreatePresetInput { - s.Description = &v - return s -} - -// SetName sets the Name field's value. -func (s *CreatePresetInput) SetName(v string) *CreatePresetInput { - s.Name = &v - return s -} - -// SetThumbnails sets the Thumbnails field's value. -func (s *CreatePresetInput) SetThumbnails(v *Thumbnails) *CreatePresetInput { - s.Thumbnails = v - return s -} - -// SetVideo sets the Video field's value. -func (s *CreatePresetInput) SetVideo(v *VideoParameters) *CreatePresetInput { - s.Video = v - return s -} - -// The CreatePresetResponse structure. -type CreatePresetOutput struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the preset - // that is created. - Preset *Preset `type:"structure"` - - // If the preset settings don't comply with the standards for the video codec - // but Elastic Transcoder created the preset, this message explains the reason - // the preset settings don't meet the standard. Elastic Transcoder created the - // preset because the settings might produce acceptable output. - Warning *string `type:"string"` -} - -// String returns the string representation -func (s CreatePresetOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreatePresetOutput) GoString() string { - return s.String() -} - -// SetPreset sets the Preset field's value. -func (s *CreatePresetOutput) SetPreset(v *Preset) *CreatePresetOutput { - s.Preset = v - return s -} - -// SetWarning sets the Warning field's value. -func (s *CreatePresetOutput) SetWarning(v string) *CreatePresetOutput { - s.Warning = &v - return s -} - -// The DeletePipelineRequest structure. -type DeletePipelineInput struct { - _ struct{} `type:"structure"` - - // The identifier of the pipeline that you want to delete. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeletePipelineInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletePipelineInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeletePipelineInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeletePipelineInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *DeletePipelineInput) SetId(v string) *DeletePipelineInput { - s.Id = &v - return s -} - -// The DeletePipelineResponse structure. -type DeletePipelineOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeletePipelineOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletePipelineOutput) GoString() string { - return s.String() -} - -// The DeletePresetRequest structure. -type DeletePresetInput struct { - _ struct{} `type:"structure"` - - // The identifier of the preset for which you want to get detailed information. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeletePresetInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletePresetInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeletePresetInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeletePresetInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *DeletePresetInput) SetId(v string) *DeletePresetInput { - s.Id = &v - return s -} - -// The DeletePresetResponse structure. -type DeletePresetOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeletePresetOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletePresetOutput) GoString() string { - return s.String() -} - -// The detected properties of the input file. Elastic Transcoder identifies -// these values from the input file. -type DetectedProperties struct { - _ struct{} `type:"structure"` - - // The detected duration of the input file, in milliseconds. - DurationMillis *int64 `type:"long"` - - // The detected file size of the input file, in bytes. - FileSize *int64 `type:"long"` - - // The detected frame rate of the input file, in frames per second. - FrameRate *string `type:"string"` - - // The detected height of the input file, in pixels. - Height *int64 `type:"integer"` - - // The detected width of the input file, in pixels. - Width *int64 `type:"integer"` -} - -// String returns the string representation -func (s DetectedProperties) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DetectedProperties) GoString() string { - return s.String() -} - -// SetDurationMillis sets the DurationMillis field's value. -func (s *DetectedProperties) SetDurationMillis(v int64) *DetectedProperties { - s.DurationMillis = &v - return s -} - -// SetFileSize sets the FileSize field's value. -func (s *DetectedProperties) SetFileSize(v int64) *DetectedProperties { - s.FileSize = &v - return s -} - -// SetFrameRate sets the FrameRate field's value. -func (s *DetectedProperties) SetFrameRate(v string) *DetectedProperties { - s.FrameRate = &v - return s -} - -// SetHeight sets the Height field's value. -func (s *DetectedProperties) SetHeight(v int64) *DetectedProperties { - s.Height = &v - return s -} - -// SetWidth sets the Width field's value. -func (s *DetectedProperties) SetWidth(v int64) *DetectedProperties { - s.Width = &v - return s -} - -// The encryption settings, if any, that are used for decrypting your input -// files or encrypting your output files. If your input file is encrypted, you -// must specify the mode that Elastic Transcoder uses to decrypt your file, -// otherwise you must specify the mode you want Elastic Transcoder to use to -// encrypt your output files. -type Encryption struct { - _ struct{} `type:"structure"` - - // The series of random bits created by a random bit generator, unique for every - // encryption operation, that you used to encrypt your input files or that you - // want Elastic Transcoder to use to encrypt your output files. The initialization - // vector must be base64-encoded, and it must be exactly 16 bytes long before - // being base64-encoded. - InitializationVector *string `type:"string"` - - // The data encryption key that you want Elastic Transcoder to use to encrypt - // your output file, or that was used to encrypt your input file. The key must - // be base64-encoded and it must be one of the following bit lengths before - // being base64-encoded: - // - // 128, 192, or 256. - // - // The key must also be encrypted by using the Amazon Key Management Service. - Key *string `type:"string"` - - // The MD5 digest of the key that you used to encrypt your input file, or that - // you want Elastic Transcoder to use to encrypt your output file. Elastic Transcoder - // uses the key digest as a checksum to make sure your key was not corrupted - // in transit. The key MD5 must be base64-encoded, and it must be exactly 16 - // bytes long before being base64-encoded. - KeyMd5 *string `type:"string"` - - // The specific server-side encryption mode that you want Elastic Transcoder - // to use when decrypting your input files or encrypting your output files. - // Elastic Transcoder supports the following options: - // - // * S3: Amazon S3 creates and manages the keys used for encrypting your - // files. - // - // * S3-AWS-KMS: Amazon S3 calls the Amazon Key Management Service, which - // creates and manages the keys that are used for encrypting your files. - // If you specify S3-AWS-KMS and you don't want to use the default key, you - // must add the AWS-KMS key that you want to use to your pipeline. - // - // * AES-CBC-PKCS7: A padded cipher-block mode of operation originally used - // for HLS files. - // - // * AES-CTR: AES Counter Mode. - // - // * AES-GCM: AES Galois Counter Mode, a mode of operation that is an authenticated - // encryption format, meaning that a file, key, or initialization vector - // that has been tampered with fails the decryption process. - // - // For all three AES options, you must provide the following settings, which - // must be base64-encoded: - // - // * Key - // - // * Key MD5 - // - // * Initialization Vector - // - // For the AES modes, your private encryption keys and your unencrypted data - // are never stored by AWS; therefore, it is important that you safely manage - // your encryption keys. If you lose them, you won't be able to unencrypt your - // data. - Mode *string `type:"string"` -} - -// String returns the string representation -func (s Encryption) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Encryption) GoString() string { - return s.String() -} - -// SetInitializationVector sets the InitializationVector field's value. -func (s *Encryption) SetInitializationVector(v string) *Encryption { - s.InitializationVector = &v - return s -} - -// SetKey sets the Key field's value. -func (s *Encryption) SetKey(v string) *Encryption { - s.Key = &v - return s -} - -// SetKeyMd5 sets the KeyMd5 field's value. -func (s *Encryption) SetKeyMd5(v string) *Encryption { - s.KeyMd5 = &v - return s -} - -// SetMode sets the Mode field's value. -func (s *Encryption) SetMode(v string) *Encryption { - s.Mode = &v - return s -} - -// The HLS content protection settings, if any, that you want Elastic Transcoder -// to apply to your output files. -type HlsContentProtection struct { - _ struct{} `type:"structure"` - - // If Elastic Transcoder is generating your key for you, you must leave this - // field blank. - // - // The series of random bits created by a random bit generator, unique for every - // encryption operation, that you want Elastic Transcoder to use to encrypt - // your output files. The initialization vector must be base64-encoded, and - // it must be exactly 16 bytes before being base64-encoded. - InitializationVector *string `type:"string"` - - // If you want Elastic Transcoder to generate a key for you, leave this field - // blank. - // - // If you choose to supply your own key, you must encrypt the key by using AWS - // KMS. The key must be base64-encoded, and it must be one of the following - // bit lengths before being base64-encoded: - // - // 128, 192, or 256. - Key *string `type:"string"` - - // If Elastic Transcoder is generating your key for you, you must leave this - // field blank. - // - // The MD5 digest of the key that you want Elastic Transcoder to use to encrypt - // your output file, and that you want Elastic Transcoder to use as a checksum - // to make sure your key was not corrupted in transit. The key MD5 must be base64-encoded, - // and it must be exactly 16 bytes before being base64- encoded. - KeyMd5 *string `type:"string"` - - // Specify whether you want Elastic Transcoder to write your HLS license key - // to an Amazon S3 bucket. If you choose WithVariantPlaylists, LicenseAcquisitionUrl - // must be left blank and Elastic Transcoder writes your data key into the same - // bucket as the associated playlist. - KeyStoragePolicy *string `type:"string"` - - // The location of the license key required to decrypt your HLS playlist. The - // URL must be an absolute path, and is referenced in the URI attribute of the - // EXT-X-KEY metadata tag in the playlist file. - LicenseAcquisitionUrl *string `type:"string"` - - // The content protection method for your output. The only valid value is: aes-128. - // - // This value is written into the method attribute of the EXT-X-KEY metadata - // tag in the output playlist. - Method *string `type:"string"` -} - -// String returns the string representation -func (s HlsContentProtection) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HlsContentProtection) GoString() string { - return s.String() -} - -// SetInitializationVector sets the InitializationVector field's value. -func (s *HlsContentProtection) SetInitializationVector(v string) *HlsContentProtection { - s.InitializationVector = &v - return s -} - -// SetKey sets the Key field's value. -func (s *HlsContentProtection) SetKey(v string) *HlsContentProtection { - s.Key = &v - return s -} - -// SetKeyMd5 sets the KeyMd5 field's value. -func (s *HlsContentProtection) SetKeyMd5(v string) *HlsContentProtection { - s.KeyMd5 = &v - return s -} - -// SetKeyStoragePolicy sets the KeyStoragePolicy field's value. -func (s *HlsContentProtection) SetKeyStoragePolicy(v string) *HlsContentProtection { - s.KeyStoragePolicy = &v - return s -} - -// SetLicenseAcquisitionUrl sets the LicenseAcquisitionUrl field's value. -func (s *HlsContentProtection) SetLicenseAcquisitionUrl(v string) *HlsContentProtection { - s.LicenseAcquisitionUrl = &v - return s -} - -// SetMethod sets the Method field's value. -func (s *HlsContentProtection) SetMethod(v string) *HlsContentProtection { - s.Method = &v - return s -} - -// The captions to be created, if any. -type InputCaptions struct { - _ struct{} `type:"structure"` - - // Source files for the input sidecar captions used during the transcoding process. - // To omit all sidecar captions, leave CaptionSources blank. - CaptionSources []*CaptionSource `type:"list"` - - // A policy that determines how Elastic Transcoder handles the existence of - // multiple captions. - // - // * MergeOverride: Elastic Transcoder transcodes both embedded and sidecar - // captions into outputs. If captions for a language are embedded in the - // input file and also appear in a sidecar file, Elastic Transcoder uses - // the sidecar captions and ignores the embedded captions for that language. - // - // * MergeRetain: Elastic Transcoder transcodes both embedded and sidecar - // captions into outputs. If captions for a language are embedded in the - // input file and also appear in a sidecar file, Elastic Transcoder uses - // the embedded captions and ignores the sidecar captions for that language. - // If CaptionSources is empty, Elastic Transcoder omits all sidecar captions - // from the output files. - // - // * Override: Elastic Transcoder transcodes only the sidecar captions that - // you specify in CaptionSources. - // - // MergePolicy cannot be null. - MergePolicy *string `type:"string"` -} - -// String returns the string representation -func (s InputCaptions) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InputCaptions) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InputCaptions) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InputCaptions"} - if s.CaptionSources != nil { - for i, v := range s.CaptionSources { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CaptionSources", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCaptionSources sets the CaptionSources field's value. -func (s *InputCaptions) SetCaptionSources(v []*CaptionSource) *InputCaptions { - s.CaptionSources = v - return s -} - -// SetMergePolicy sets the MergePolicy field's value. -func (s *InputCaptions) SetMergePolicy(v string) *InputCaptions { - s.MergePolicy = &v - return s -} - -// A section of the response body that provides information about the job that -// is created. -type Job struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) for the job. - Arn *string `type:"string"` - - // The identifier that Elastic Transcoder assigned to the job. You use this - // value to get settings for the job or to delete the job. - Id *string `type:"string"` - - // A section of the request or response body that provides information about - // the file that is being transcoded. - Input *JobInput `type:"structure"` - - // Information about the files that you're transcoding. If you specified multiple - // files for this job, Elastic Transcoder stitches the files together to make - // one output. - Inputs []*JobInput `type:"list"` - - // If you specified one output for a job, information about that output. If - // you specified multiple outputs for a job, the Output object lists information - // about the first output. This duplicates the information that is listed for - // the first output in the Outputs object. - // - // Outputs recommended instead. - // - // A section of the request or response body that provides information about - // the transcoded (target) file. - Output *JobOutput `type:"structure"` - - // The value, if any, that you want Elastic Transcoder to prepend to the names - // of all files that this job creates, including output files, thumbnails, and - // playlists. We recommend that you add a / or some other delimiter to the end - // of the OutputKeyPrefix. - OutputKeyPrefix *string `min:"1" type:"string"` - - // Information about the output files. We recommend that you use the Outputs - // syntax for all jobs, even when you want Elastic Transcoder to transcode a - // file into only one format. Do not use both the Outputs and Output syntaxes - // in the same request. You can create a maximum of 30 outputs per job. - // - // If you specify more than one output for a job, Elastic Transcoder creates - // the files for each output in the order in which you specify them in the job. - Outputs []*JobOutput `type:"list"` - - // The Id of the pipeline that you want Elastic Transcoder to use for transcoding. - // The pipeline determines several settings, including the Amazon S3 bucket - // from which Elastic Transcoder gets the files to transcode and the bucket - // into which Elastic Transcoder puts the transcoded files. - PipelineId *string `type:"string"` - - // Outputs in Fragmented MP4 or MPEG-TS format only. - // - // If you specify a preset in PresetId for which the value of Container is fmp4 - // (Fragmented MP4) or ts (MPEG-TS), Playlists contains information about the - // master playlists that you want Elastic Transcoder to create. - // - // The maximum number of master playlists in a job is 30. - Playlists []*Playlist `type:"list"` - - // The status of the job: Submitted, Progressing, Complete, Canceled, or Error. - Status *string `type:"string"` - - // Details about the timing of a job. - Timing *Timing `type:"structure"` - - // User-defined metadata that you want to associate with an Elastic Transcoder - // job. You specify metadata in key/value pairs, and you can add up to 10 key/value - // pairs per job. Elastic Transcoder does not guarantee that key/value pairs - // are returned in the same order in which you specify them. - // - // Metadata keys and values must use characters from the following list: - // - // * 0-9 - // - // * A-Z and a-z - // - // * Space - // - // * The following symbols: _.:/=+-%@ - UserMetadata map[string]*string `type:"map"` -} - -// String returns the string representation -func (s Job) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Job) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *Job) SetArn(v string) *Job { - s.Arn = &v - return s -} - -// SetId sets the Id field's value. -func (s *Job) SetId(v string) *Job { - s.Id = &v - return s -} - -// SetInput sets the Input field's value. -func (s *Job) SetInput(v *JobInput) *Job { - s.Input = v - return s -} - -// SetInputs sets the Inputs field's value. -func (s *Job) SetInputs(v []*JobInput) *Job { - s.Inputs = v - return s -} - -// SetOutput sets the Output field's value. -func (s *Job) SetOutput(v *JobOutput) *Job { - s.Output = v - return s -} - -// SetOutputKeyPrefix sets the OutputKeyPrefix field's value. -func (s *Job) SetOutputKeyPrefix(v string) *Job { - s.OutputKeyPrefix = &v - return s -} - -// SetOutputs sets the Outputs field's value. -func (s *Job) SetOutputs(v []*JobOutput) *Job { - s.Outputs = v - return s -} - -// SetPipelineId sets the PipelineId field's value. -func (s *Job) SetPipelineId(v string) *Job { - s.PipelineId = &v - return s -} - -// SetPlaylists sets the Playlists field's value. -func (s *Job) SetPlaylists(v []*Playlist) *Job { - s.Playlists = v - return s -} - -// SetStatus sets the Status field's value. -func (s *Job) SetStatus(v string) *Job { - s.Status = &v - return s -} - -// SetTiming sets the Timing field's value. -func (s *Job) SetTiming(v *Timing) *Job { - s.Timing = v - return s -} - -// SetUserMetadata sets the UserMetadata field's value. -func (s *Job) SetUserMetadata(v map[string]*string) *Job { - s.UserMetadata = v - return s -} - -// The .jpg or .png file associated with an audio file. -type JobAlbumArt struct { - _ struct{} `type:"structure"` - - // The file to be used as album art. There can be multiple artworks associated - // with an audio file, to a maximum of 20. Valid formats are .jpg and .png - Artwork []*Artwork `type:"list"` - - // A policy that determines how Elastic Transcoder handles the existence of - // multiple album artwork files. - // - // * Replace: The specified album art replaces any existing album art. - // - // * Prepend: The specified album art is placed in front of any existing - // album art. - // - // * Append: The specified album art is placed after any existing album art. - // - // * Fallback: If the original input file contains artwork, Elastic Transcoder - // uses that artwork for the output. If the original input does not contain - // artwork, Elastic Transcoder uses the specified album art file. - MergePolicy *string `type:"string"` -} - -// String returns the string representation -func (s JobAlbumArt) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s JobAlbumArt) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *JobAlbumArt) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "JobAlbumArt"} - if s.Artwork != nil { - for i, v := range s.Artwork { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Artwork", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetArtwork sets the Artwork field's value. -func (s *JobAlbumArt) SetArtwork(v []*Artwork) *JobAlbumArt { - s.Artwork = v - return s -} - -// SetMergePolicy sets the MergePolicy field's value. -func (s *JobAlbumArt) SetMergePolicy(v string) *JobAlbumArt { - s.MergePolicy = &v - return s -} - -// Information about the file that you're transcoding. -type JobInput struct { - _ struct{} `type:"structure"` - - // The aspect ratio of the input file. If you want Elastic Transcoder to automatically - // detect the aspect ratio of the input file, specify auto. If you want to specify - // the aspect ratio for the output file, enter one of the following values: - // - // 1:1, 4:3, 3:2, 16:9 - // - // If you specify a value other than auto, Elastic Transcoder disables automatic - // detection of the aspect ratio. - AspectRatio *string `type:"string"` - - // The container type for the input file. If you want Elastic Transcoder to - // automatically detect the container type of the input file, specify auto. - // If you want to specify the container type for the input file, enter one of - // the following values: - // - // 3gp, aac, asf, avi, divx, flv, m4a, mkv, mov, mp3, mp4, mpeg, mpeg-ps, mpeg-ts, - // mxf, ogg, vob, wav, webm - Container *string `type:"string"` - - // The detected properties of the input file. - DetectedProperties *DetectedProperties `type:"structure"` - - // The encryption settings, if any, that are used for decrypting your input - // files. If your input file is encrypted, you must specify the mode that Elastic - // Transcoder uses to decrypt your file. - Encryption *Encryption `type:"structure"` - - // The frame rate of the input file. If you want Elastic Transcoder to automatically - // detect the frame rate of the input file, specify auto. If you want to specify - // the frame rate for the input file, enter one of the following values: - // - // 10, 15, 23.97, 24, 25, 29.97, 30, 60 - // - // If you specify a value other than auto, Elastic Transcoder disables automatic - // detection of the frame rate. - FrameRate *string `type:"string"` - - // You can configure Elastic Transcoder to transcode captions, or subtitles, - // from one format to another. All captions must be in UTF-8. Elastic Transcoder - // supports two types of captions: - // - // * Embedded: Embedded captions are included in the same file as the audio - // and video. Elastic Transcoder supports only one embedded caption per language, - // to a maximum of 300 embedded captions per file. - // - // Valid input values include: CEA-608 (EIA-608, first non-empty channel only), - // CEA-708 (EIA-708, first non-empty channel only), and mov-text - // - // Valid outputs include: mov-text - // - // Elastic Transcoder supports a maximum of one embedded format per output. - // - // * Sidecar: Sidecar captions are kept in a separate metadata file from - // the audio and video data. Sidecar captions require a player that is capable - // of understanding the relationship between the video file and the sidecar - // file. Elastic Transcoder supports only one sidecar caption per language, - // to a maximum of 20 sidecar captions per file. - // - // Valid input values include: dfxp (first div element only), ebu-tt, scc, smpt, - // srt, ttml (first div element only), and webvtt - // - // Valid outputs include: dfxp (first div element only), scc, srt, and webvtt. - // - // If you want ttml or smpte-tt compatible captions, specify dfxp as your output - // format. - // - // Elastic Transcoder does not support OCR (Optical Character Recognition), - // does not accept pictures as a valid input for captions, and is not available - // for audio-only transcoding. Elastic Transcoder does not preserve text formatting - // (for example, italics) during the transcoding process. - // - // To remove captions or leave the captions empty, set Captions to null. To - // pass through existing captions unchanged, set the MergePolicy to MergeRetain, - // and pass in a null CaptionSources array. - // - // For more information on embedded files, see the Subtitles Wikipedia page. - // - // For more information on sidecar files, see the Extensible Metadata Platform - // and Sidecar file Wikipedia pages. - InputCaptions *InputCaptions `type:"structure"` - - // Whether the input file is interlaced. If you want Elastic Transcoder to automatically - // detect whether the input file is interlaced, specify auto. If you want to - // specify whether the input file is interlaced, enter one of the following - // values: - // - // true, false - // - // If you specify a value other than auto, Elastic Transcoder disables automatic - // detection of interlacing. - Interlaced *string `type:"string"` - - // The name of the file to transcode. Elsewhere in the body of the JSON block - // is the the ID of the pipeline to use for processing the job. The InputBucket - // object in that pipeline tells Elastic Transcoder which Amazon S3 bucket to - // get the file from. - // - // If the file name includes a prefix, such as cooking/lasagna.mpg, include - // the prefix in the key. If the file isn't in the specified bucket, Elastic - // Transcoder returns an error. - Key *string `min:"1" type:"string"` - - // This value must be auto, which causes Elastic Transcoder to automatically - // detect the resolution of the input file. - Resolution *string `type:"string"` - - // Settings for clipping an input. Each input can have different clip settings. - TimeSpan *TimeSpan `type:"structure"` -} - -// String returns the string representation -func (s JobInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s JobInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *JobInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "JobInput"} - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.InputCaptions != nil { - if err := s.InputCaptions.Validate(); err != nil { - invalidParams.AddNested("InputCaptions", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAspectRatio sets the AspectRatio field's value. -func (s *JobInput) SetAspectRatio(v string) *JobInput { - s.AspectRatio = &v - return s -} - -// SetContainer sets the Container field's value. -func (s *JobInput) SetContainer(v string) *JobInput { - s.Container = &v - return s -} - -// SetDetectedProperties sets the DetectedProperties field's value. -func (s *JobInput) SetDetectedProperties(v *DetectedProperties) *JobInput { - s.DetectedProperties = v - return s -} - -// SetEncryption sets the Encryption field's value. -func (s *JobInput) SetEncryption(v *Encryption) *JobInput { - s.Encryption = v - return s -} - -// SetFrameRate sets the FrameRate field's value. -func (s *JobInput) SetFrameRate(v string) *JobInput { - s.FrameRate = &v - return s -} - -// SetInputCaptions sets the InputCaptions field's value. -func (s *JobInput) SetInputCaptions(v *InputCaptions) *JobInput { - s.InputCaptions = v - return s -} - -// SetInterlaced sets the Interlaced field's value. -func (s *JobInput) SetInterlaced(v string) *JobInput { - s.Interlaced = &v - return s -} - -// SetKey sets the Key field's value. -func (s *JobInput) SetKey(v string) *JobInput { - s.Key = &v - return s -} - -// SetResolution sets the Resolution field's value. -func (s *JobInput) SetResolution(v string) *JobInput { - s.Resolution = &v - return s -} - -// SetTimeSpan sets the TimeSpan field's value. -func (s *JobInput) SetTimeSpan(v *TimeSpan) *JobInput { - s.TimeSpan = v - return s -} - -// Outputs recommended instead. -// -// If you specified one output for a job, information about that output. If -// you specified multiple outputs for a job, the Output object lists information -// about the first output. This duplicates the information that is listed for -// the first output in the Outputs object. -type JobOutput struct { - _ struct{} `type:"structure"` - - // The album art to be associated with the output file, if any. - AlbumArt *JobAlbumArt `type:"structure"` - - // If Elastic Transcoder used a preset with a ColorSpaceConversionMode to transcode - // the output file, the AppliedColorSpaceConversion parameter shows the conversion - // used. If no ColorSpaceConversionMode was defined in the preset, this parameter - // is not be included in the job response. - AppliedColorSpaceConversion *string `type:"string"` - - // You can configure Elastic Transcoder to transcode captions, or subtitles, - // from one format to another. All captions must be in UTF-8. Elastic Transcoder - // supports two types of captions: - // - // * Embedded: Embedded captions are included in the same file as the audio - // and video. Elastic Transcoder supports only one embedded caption per language, - // to a maximum of 300 embedded captions per file. - // - // Valid input values include: CEA-608 (EIA-608, first non-empty channel only), - // CEA-708 (EIA-708, first non-empty channel only), and mov-text - // - // Valid outputs include: mov-text - // - // Elastic Transcoder supports a maximum of one embedded format per output. - // - // * Sidecar: Sidecar captions are kept in a separate metadata file from - // the audio and video data. Sidecar captions require a player that is capable - // of understanding the relationship between the video file and the sidecar - // file. Elastic Transcoder supports only one sidecar caption per language, - // to a maximum of 20 sidecar captions per file. - // - // Valid input values include: dfxp (first div element only), ebu-tt, scc, smpt, - // srt, ttml (first div element only), and webvtt - // - // Valid outputs include: dfxp (first div element only), scc, srt, and webvtt. - // - // If you want ttml or smpte-tt compatible captions, specify dfxp as your output - // format. - // - // Elastic Transcoder does not support OCR (Optical Character Recognition), - // does not accept pictures as a valid input for captions, and is not available - // for audio-only transcoding. Elastic Transcoder does not preserve text formatting - // (for example, italics) during the transcoding process. - // - // To remove captions or leave the captions empty, set Captions to null. To - // pass through existing captions unchanged, set the MergePolicy to MergeRetain, - // and pass in a null CaptionSources array. - // - // For more information on embedded files, see the Subtitles Wikipedia page. - // - // For more information on sidecar files, see the Extensible Metadata Platform - // and Sidecar file Wikipedia pages. - Captions *Captions `type:"structure"` - - // You can create an output file that contains an excerpt from the input file. - // This excerpt, called a clip, can come from the beginning, middle, or end - // of the file. The Composition object contains settings for the clips that - // make up an output file. For the current release, you can only specify settings - // for a single clip per output file. The Composition object cannot be null. - Composition []*Clip `deprecated:"true" type:"list"` - - // Duration of the output file, in seconds. - Duration *int64 `type:"long"` - - // Duration of the output file, in milliseconds. - DurationMillis *int64 `type:"long"` - - // The encryption settings, if any, that you want Elastic Transcoder to apply - // to your output files. If you choose to use encryption, you must specify a - // mode to use. If you choose not to use encryption, Elastic Transcoder writes - // an unencrypted file to your Amazon S3 bucket. - Encryption *Encryption `type:"structure"` - - // File size of the output file, in bytes. - FileSize *int64 `type:"long"` - - // Frame rate of the output file, in frames per second. - FrameRate *string `type:"string"` - - // Height of the output file, in pixels. - Height *int64 `type:"integer"` - - // A sequential counter, starting with 1, that identifies an output among the - // outputs from the current job. In the Output syntax, this value is always - // 1. - Id *string `type:"string"` - - // The name to assign to the transcoded file. Elastic Transcoder saves the file - // in the Amazon S3 bucket specified by the OutputBucket object in the pipeline - // that is specified by the pipeline ID. - Key *string `min:"1" type:"string"` - - // The value of the Id object for the preset that you want to use for this job. - // The preset determines the audio, video, and thumbnail settings that Elastic - // Transcoder uses for transcoding. To use a preset that you created, specify - // the preset ID that Elastic Transcoder returned in the response when you created - // the preset. You can also use the Elastic Transcoder system presets, which - // you can get with ListPresets. - PresetId *string `type:"string"` - - // The number of degrees clockwise by which you want Elastic Transcoder to rotate - // the output relative to the input. Enter one of the following values: - // - // auto, 0, 90, 180, 270 - // - // The value auto generally works only if the file that you're transcoding contains - // rotation metadata. - Rotate *string `type:"string"` - - // (Outputs in Fragmented MP4 or MPEG-TS format only. - // - // If you specify a preset in PresetId for which the value of Container is fmp4 - // (Fragmented MP4) or ts (MPEG-TS), SegmentDuration is the target maximum duration - // of each segment in seconds. For HLSv3 format playlists, each media segment - // is stored in a separate .ts file. For HLSv4, MPEG-DASH, and Smooth playlists, - // all media segments for an output are stored in a single file. Each segment - // is approximately the length of the SegmentDuration, though individual segments - // might be shorter or longer. - // - // The range of valid values is 1 to 60 seconds. If the duration of the video - // is not evenly divisible by SegmentDuration, the duration of the last segment - // is the remainder of total length/SegmentDuration. - // - // Elastic Transcoder creates an output-specific playlist for each output HLS - // output that you specify in OutputKeys. To add an output to the master playlist - // for this job, include it in the OutputKeys of the associated playlist. - SegmentDuration *string `type:"string"` - - // The status of one output in a job. If you specified only one output for the - // job, Outputs:Status is always the same as Job:Status. If you specified more - // than one output: - // - // * Job:Status and Outputs:Status for all of the outputs is Submitted until - // Elastic Transcoder starts to process the first output. - // - // * When Elastic Transcoder starts to process the first output, Outputs:Status - // for that output and Job:Status both change to Progressing. For each output, - // the value of Outputs:Status remains Submitted until Elastic Transcoder - // starts to process the output. - // - // * Job:Status remains Progressing until all of the outputs reach a terminal - // status, either Complete or Error. - // - // * When all of the outputs reach a terminal status, Job:Status changes - // to Complete only if Outputs:Status for all of the outputs is Complete. - // If Outputs:Status for one or more outputs is Error, the terminal status - // for Job:Status is also Error. - // - // The value of Status is one of the following: Submitted, Progressing, Complete, - // Canceled, or Error. - Status *string `type:"string"` - - // Information that further explains Status. - StatusDetail *string `type:"string"` - - // The encryption settings, if any, that you want Elastic Transcoder to apply - // to your thumbnail. - ThumbnailEncryption *Encryption `type:"structure"` - - // Whether you want Elastic Transcoder to create thumbnails for your videos - // and, if so, how you want Elastic Transcoder to name the files. - // - // If you don't want Elastic Transcoder to create thumbnails, specify "". - // - // If you do want Elastic Transcoder to create thumbnails, specify the information - // that you want to include in the file name for each thumbnail. You can specify - // the following values in any sequence: - // - // * {count} (Required): If you want to create thumbnails, you must include - // {count} in the ThumbnailPattern object. Wherever you specify {count}, - // Elastic Transcoder adds a five-digit sequence number (beginning with 00001) - // to thumbnail file names. The number indicates where a given thumbnail - // appears in the sequence of thumbnails for a transcoded file. - // - // If you specify a literal value and/or {resolution} but you omit {count}, - // Elastic Transcoder returns a validation error and does not create the - // job. - // - // * Literal values (Optional): You can specify literal values anywhere in - // the ThumbnailPattern object. For example, you can include them as a file - // name prefix or as a delimiter between {resolution} and {count}. - // - // * {resolution} (Optional): If you want Elastic Transcoder to include the - // resolution in the file name, include {resolution} in the ThumbnailPattern - // object. - // - // When creating thumbnails, Elastic Transcoder automatically saves the files - // in the format (.jpg or .png) that appears in the preset that you specified - // in the PresetID value of CreateJobOutput. Elastic Transcoder also appends - // the applicable file name extension. - ThumbnailPattern *string `type:"string"` - - // Information about the watermarks that you want Elastic Transcoder to add - // to the video during transcoding. You can specify up to four watermarks for - // each output. Settings for each watermark must be defined in the preset that - // you specify in Preset for the current output. - // - // Watermarks are added to the output video in the sequence in which you list - // them in the job output—the first watermark in the list is added to the output - // video first, the second watermark in the list is added next, and so on. As - // a result, if the settings in a preset cause Elastic Transcoder to place all - // watermarks in the same location, the second watermark that you add covers - // the first one, the third one covers the second, and the fourth one covers - // the third. - Watermarks []*JobWatermark `type:"list"` - - // Specifies the width of the output file in pixels. - Width *int64 `type:"integer"` -} - -// String returns the string representation -func (s JobOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s JobOutput) GoString() string { - return s.String() -} - -// SetAlbumArt sets the AlbumArt field's value. -func (s *JobOutput) SetAlbumArt(v *JobAlbumArt) *JobOutput { - s.AlbumArt = v - return s -} - -// SetAppliedColorSpaceConversion sets the AppliedColorSpaceConversion field's value. -func (s *JobOutput) SetAppliedColorSpaceConversion(v string) *JobOutput { - s.AppliedColorSpaceConversion = &v - return s -} - -// SetCaptions sets the Captions field's value. -func (s *JobOutput) SetCaptions(v *Captions) *JobOutput { - s.Captions = v - return s -} - -// SetComposition sets the Composition field's value. -func (s *JobOutput) SetComposition(v []*Clip) *JobOutput { - s.Composition = v - return s -} - -// SetDuration sets the Duration field's value. -func (s *JobOutput) SetDuration(v int64) *JobOutput { - s.Duration = &v - return s -} - -// SetDurationMillis sets the DurationMillis field's value. -func (s *JobOutput) SetDurationMillis(v int64) *JobOutput { - s.DurationMillis = &v - return s -} - -// SetEncryption sets the Encryption field's value. -func (s *JobOutput) SetEncryption(v *Encryption) *JobOutput { - s.Encryption = v - return s -} - -// SetFileSize sets the FileSize field's value. -func (s *JobOutput) SetFileSize(v int64) *JobOutput { - s.FileSize = &v - return s -} - -// SetFrameRate sets the FrameRate field's value. -func (s *JobOutput) SetFrameRate(v string) *JobOutput { - s.FrameRate = &v - return s -} - -// SetHeight sets the Height field's value. -func (s *JobOutput) SetHeight(v int64) *JobOutput { - s.Height = &v - return s -} - -// SetId sets the Id field's value. -func (s *JobOutput) SetId(v string) *JobOutput { - s.Id = &v - return s -} - -// SetKey sets the Key field's value. -func (s *JobOutput) SetKey(v string) *JobOutput { - s.Key = &v - return s -} - -// SetPresetId sets the PresetId field's value. -func (s *JobOutput) SetPresetId(v string) *JobOutput { - s.PresetId = &v - return s -} - -// SetRotate sets the Rotate field's value. -func (s *JobOutput) SetRotate(v string) *JobOutput { - s.Rotate = &v - return s -} - -// SetSegmentDuration sets the SegmentDuration field's value. -func (s *JobOutput) SetSegmentDuration(v string) *JobOutput { - s.SegmentDuration = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *JobOutput) SetStatus(v string) *JobOutput { - s.Status = &v - return s -} - -// SetStatusDetail sets the StatusDetail field's value. -func (s *JobOutput) SetStatusDetail(v string) *JobOutput { - s.StatusDetail = &v - return s -} - -// SetThumbnailEncryption sets the ThumbnailEncryption field's value. -func (s *JobOutput) SetThumbnailEncryption(v *Encryption) *JobOutput { - s.ThumbnailEncryption = v - return s -} - -// SetThumbnailPattern sets the ThumbnailPattern field's value. -func (s *JobOutput) SetThumbnailPattern(v string) *JobOutput { - s.ThumbnailPattern = &v - return s -} - -// SetWatermarks sets the Watermarks field's value. -func (s *JobOutput) SetWatermarks(v []*JobWatermark) *JobOutput { - s.Watermarks = v - return s -} - -// SetWidth sets the Width field's value. -func (s *JobOutput) SetWidth(v int64) *JobOutput { - s.Width = &v - return s -} - -// Watermarks can be in .png or .jpg format. If you want to display a watermark -// that is not rectangular, use the .png format, which supports transparency. -type JobWatermark struct { - _ struct{} `type:"structure"` - - // The encryption settings, if any, that you want Elastic Transcoder to apply - // to your watermarks. - Encryption *Encryption `type:"structure"` - - // The name of the .png or .jpg file that you want to use for the watermark. - // To determine which Amazon S3 bucket contains the specified file, Elastic - // Transcoder checks the pipeline specified by Pipeline; the Input Bucket object - // in that pipeline identifies the bucket. - // - // If the file name includes a prefix, for example, logos/128x64.png, include - // the prefix in the key. If the file isn't in the specified bucket, Elastic - // Transcoder returns an error. - InputKey *string `min:"1" type:"string"` - - // The ID of the watermark settings that Elastic Transcoder uses to add watermarks - // to the video during transcoding. The settings are in the preset specified - // by Preset for the current output. In that preset, the value of Watermarks - // Id tells Elastic Transcoder which settings to use. - PresetWatermarkId *string `min:"1" type:"string"` -} - -// String returns the string representation -func (s JobWatermark) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s JobWatermark) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *JobWatermark) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "JobWatermark"} - if s.InputKey != nil && len(*s.InputKey) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InputKey", 1)) - } - if s.PresetWatermarkId != nil && len(*s.PresetWatermarkId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PresetWatermarkId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryption sets the Encryption field's value. -func (s *JobWatermark) SetEncryption(v *Encryption) *JobWatermark { - s.Encryption = v - return s -} - -// SetInputKey sets the InputKey field's value. -func (s *JobWatermark) SetInputKey(v string) *JobWatermark { - s.InputKey = &v - return s -} - -// SetPresetWatermarkId sets the PresetWatermarkId field's value. -func (s *JobWatermark) SetPresetWatermarkId(v string) *JobWatermark { - s.PresetWatermarkId = &v - return s -} - -// The ListJobsByPipelineRequest structure. -type ListJobsByPipelineInput struct { - _ struct{} `type:"structure"` - - // To list jobs in chronological order by the date and time that they were submitted, - // enter true. To list jobs in reverse chronological order, enter false. - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - // When Elastic Transcoder returns more than one page of results, use pageToken - // in subsequent GET requests to get each successive page of results. - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - // The ID of the pipeline for which you want to get job information. - // - // PipelineId is a required field - PipelineId *string `location:"uri" locationName:"PipelineId" type:"string" required:"true"` -} - -// String returns the string representation -func (s ListJobsByPipelineInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListJobsByPipelineInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListJobsByPipelineInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListJobsByPipelineInput"} - if s.PipelineId == nil { - invalidParams.Add(request.NewErrParamRequired("PipelineId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAscending sets the Ascending field's value. -func (s *ListJobsByPipelineInput) SetAscending(v string) *ListJobsByPipelineInput { - s.Ascending = &v - return s -} - -// SetPageToken sets the PageToken field's value. -func (s *ListJobsByPipelineInput) SetPageToken(v string) *ListJobsByPipelineInput { - s.PageToken = &v - return s -} - -// SetPipelineId sets the PipelineId field's value. -func (s *ListJobsByPipelineInput) SetPipelineId(v string) *ListJobsByPipelineInput { - s.PipelineId = &v - return s -} - -// The ListJobsByPipelineResponse structure. -type ListJobsByPipelineOutput struct { - _ struct{} `type:"structure"` - - // An array of Job objects that are in the specified pipeline. - Jobs []*Job `type:"list"` - - // A value that you use to access the second and subsequent pages of results, - // if any. When the jobs in the specified pipeline fit on one page or when you've - // reached the last page of results, the value of NextPageToken is null. - NextPageToken *string `type:"string"` -} - -// String returns the string representation -func (s ListJobsByPipelineOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListJobsByPipelineOutput) GoString() string { - return s.String() -} - -// SetJobs sets the Jobs field's value. -func (s *ListJobsByPipelineOutput) SetJobs(v []*Job) *ListJobsByPipelineOutput { - s.Jobs = v - return s -} - -// SetNextPageToken sets the NextPageToken field's value. -func (s *ListJobsByPipelineOutput) SetNextPageToken(v string) *ListJobsByPipelineOutput { - s.NextPageToken = &v - return s -} - -// The ListJobsByStatusRequest structure. -type ListJobsByStatusInput struct { - _ struct{} `type:"structure"` - - // To list jobs in chronological order by the date and time that they were submitted, - // enter true. To list jobs in reverse chronological order, enter false. - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - // When Elastic Transcoder returns more than one page of results, use pageToken - // in subsequent GET requests to get each successive page of results. - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` - - // To get information about all of the jobs associated with the current AWS - // account that have a given status, specify the following status: Submitted, - // Progressing, Complete, Canceled, or Error. - // - // Status is a required field - Status *string `location:"uri" locationName:"Status" type:"string" required:"true"` -} - -// String returns the string representation -func (s ListJobsByStatusInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListJobsByStatusInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListJobsByStatusInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListJobsByStatusInput"} - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAscending sets the Ascending field's value. -func (s *ListJobsByStatusInput) SetAscending(v string) *ListJobsByStatusInput { - s.Ascending = &v - return s -} - -// SetPageToken sets the PageToken field's value. -func (s *ListJobsByStatusInput) SetPageToken(v string) *ListJobsByStatusInput { - s.PageToken = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *ListJobsByStatusInput) SetStatus(v string) *ListJobsByStatusInput { - s.Status = &v - return s -} - -// The ListJobsByStatusResponse structure. -type ListJobsByStatusOutput struct { - _ struct{} `type:"structure"` - - // An array of Job objects that have the specified status. - Jobs []*Job `type:"list"` - - // A value that you use to access the second and subsequent pages of results, - // if any. When the jobs in the specified pipeline fit on one page or when you've - // reached the last page of results, the value of NextPageToken is null. - NextPageToken *string `type:"string"` -} - -// String returns the string representation -func (s ListJobsByStatusOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListJobsByStatusOutput) GoString() string { - return s.String() -} - -// SetJobs sets the Jobs field's value. -func (s *ListJobsByStatusOutput) SetJobs(v []*Job) *ListJobsByStatusOutput { - s.Jobs = v - return s -} - -// SetNextPageToken sets the NextPageToken field's value. -func (s *ListJobsByStatusOutput) SetNextPageToken(v string) *ListJobsByStatusOutput { - s.NextPageToken = &v - return s -} - -// The ListPipelineRequest structure. -type ListPipelinesInput struct { - _ struct{} `type:"structure"` - - // To list pipelines in chronological order by the date and time that they were - // created, enter true. To list pipelines in reverse chronological order, enter - // false. - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - // When Elastic Transcoder returns more than one page of results, use pageToken - // in subsequent GET requests to get each successive page of results. - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` -} - -// String returns the string representation -func (s ListPipelinesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPipelinesInput) GoString() string { - return s.String() -} - -// SetAscending sets the Ascending field's value. -func (s *ListPipelinesInput) SetAscending(v string) *ListPipelinesInput { - s.Ascending = &v - return s -} - -// SetPageToken sets the PageToken field's value. -func (s *ListPipelinesInput) SetPageToken(v string) *ListPipelinesInput { - s.PageToken = &v - return s -} - -// A list of the pipelines associated with the current AWS account. -type ListPipelinesOutput struct { - _ struct{} `type:"structure"` - - // A value that you use to access the second and subsequent pages of results, - // if any. When the pipelines fit on one page or when you've reached the last - // page of results, the value of NextPageToken is null. - NextPageToken *string `type:"string"` - - // An array of Pipeline objects. - Pipelines []*Pipeline `type:"list"` -} - -// String returns the string representation -func (s ListPipelinesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPipelinesOutput) GoString() string { - return s.String() -} - -// SetNextPageToken sets the NextPageToken field's value. -func (s *ListPipelinesOutput) SetNextPageToken(v string) *ListPipelinesOutput { - s.NextPageToken = &v - return s -} - -// SetPipelines sets the Pipelines field's value. -func (s *ListPipelinesOutput) SetPipelines(v []*Pipeline) *ListPipelinesOutput { - s.Pipelines = v - return s -} - -// The ListPresetsRequest structure. -type ListPresetsInput struct { - _ struct{} `type:"structure"` - - // To list presets in chronological order by the date and time that they were - // created, enter true. To list presets in reverse chronological order, enter - // false. - Ascending *string `location:"querystring" locationName:"Ascending" type:"string"` - - // When Elastic Transcoder returns more than one page of results, use pageToken - // in subsequent GET requests to get each successive page of results. - PageToken *string `location:"querystring" locationName:"PageToken" type:"string"` -} - -// String returns the string representation -func (s ListPresetsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPresetsInput) GoString() string { - return s.String() -} - -// SetAscending sets the Ascending field's value. -func (s *ListPresetsInput) SetAscending(v string) *ListPresetsInput { - s.Ascending = &v - return s -} - -// SetPageToken sets the PageToken field's value. -func (s *ListPresetsInput) SetPageToken(v string) *ListPresetsInput { - s.PageToken = &v - return s -} - -// The ListPresetsResponse structure. -type ListPresetsOutput struct { - _ struct{} `type:"structure"` - - // A value that you use to access the second and subsequent pages of results, - // if any. When the presets fit on one page or when you've reached the last - // page of results, the value of NextPageToken is null. - NextPageToken *string `type:"string"` - - // An array of Preset objects. - Presets []*Preset `type:"list"` -} - -// String returns the string representation -func (s ListPresetsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPresetsOutput) GoString() string { - return s.String() -} - -// SetNextPageToken sets the NextPageToken field's value. -func (s *ListPresetsOutput) SetNextPageToken(v string) *ListPresetsOutput { - s.NextPageToken = &v - return s -} - -// SetPresets sets the Presets field's value. -func (s *ListPresetsOutput) SetPresets(v []*Preset) *ListPresetsOutput { - s.Presets = v - return s -} - -// The Amazon Simple Notification Service (Amazon SNS) topic or topics to notify -// in order to report job status. -// -// To receive notifications, you must also subscribe to the new topic in the -// Amazon SNS console. -type Notifications struct { - _ struct{} `type:"structure"` - - // The Amazon SNS topic that you want to notify when Elastic Transcoder has - // finished processing the job. - Completed *string `type:"string"` - - // The Amazon SNS topic that you want to notify when Elastic Transcoder encounters - // an error condition. - Error *string `type:"string"` - - // The Amazon Simple Notification Service (Amazon SNS) topic that you want to - // notify when Elastic Transcoder has started to process the job. - Progressing *string `type:"string"` - - // The Amazon SNS topic that you want to notify when Elastic Transcoder encounters - // a warning condition. - Warning *string `type:"string"` -} - -// String returns the string representation -func (s Notifications) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Notifications) GoString() string { - return s.String() -} - -// SetCompleted sets the Completed field's value. -func (s *Notifications) SetCompleted(v string) *Notifications { - s.Completed = &v - return s -} - -// SetError sets the Error field's value. -func (s *Notifications) SetError(v string) *Notifications { - s.Error = &v - return s -} - -// SetProgressing sets the Progressing field's value. -func (s *Notifications) SetProgressing(v string) *Notifications { - s.Progressing = &v - return s -} - -// SetWarning sets the Warning field's value. -func (s *Notifications) SetWarning(v string) *Notifications { - s.Warning = &v - return s -} - -// The Permission structure. -type Permission struct { - _ struct{} `type:"structure"` - - // The permission that you want to give to the AWS user that is listed in Grantee. - // Valid values include: - // - // * READ: The grantee can read the thumbnails and metadata for thumbnails - // that Elastic Transcoder adds to the Amazon S3 bucket. - // - // * READ_ACP: The grantee can read the object ACL for thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // * WRITE_ACP: The grantee can write the ACL for the thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // * FULL_CONTROL: The grantee has READ, READ_ACP, and WRITE_ACP permissions - // for the thumbnails that Elastic Transcoder adds to the Amazon S3 bucket. - Access []*string `type:"list"` - - // The AWS user or group that you want to have access to transcoded files and - // playlists. To identify the user or group, you can specify the canonical user - // ID for an AWS account, an origin access identity for a CloudFront distribution, - // the registered email address of an AWS account, or a predefined Amazon S3 - // group. - Grantee *string `min:"1" type:"string"` - - // The type of value that appears in the Grantee object: - // - // * Canonical: Either the canonical user ID for an AWS account or an origin - // access identity for an Amazon CloudFront distribution. - // - // A canonical user ID is not the same as an AWS account number. - // - // * Email: The registered email address of an AWS account. - // - // * Group: One of the following predefined Amazon S3 groups: AllUsers, AuthenticatedUsers, - // or LogDelivery. - GranteeType *string `type:"string"` -} - -// String returns the string representation -func (s Permission) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Permission) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Permission) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Permission"} - if s.Grantee != nil && len(*s.Grantee) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Grantee", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccess sets the Access field's value. -func (s *Permission) SetAccess(v []*string) *Permission { - s.Access = v - return s -} - -// SetGrantee sets the Grantee field's value. -func (s *Permission) SetGrantee(v string) *Permission { - s.Grantee = &v - return s -} - -// SetGranteeType sets the GranteeType field's value. -func (s *Permission) SetGranteeType(v string) *Permission { - s.GranteeType = &v - return s -} - -// The pipeline (queue) that is used to manage jobs. -type Pipeline struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) for the pipeline. - Arn *string `type:"string"` - - // The AWS Key Management Service (AWS KMS) key that you want to use with this - // pipeline. - // - // If you use either S3 or S3-AWS-KMS as your Encryption:Mode, you don't need - // to provide a key with your job because a default key, known as an AWS-KMS - // key, is created for you automatically. You need to provide an AWS-KMS key - // only if you want to use a non-default AWS-KMS key, or if you are using an - // Encryption:Mode of AES-PKCS7, AES-CTR, or AES-GCM. - AwsKmsKeyArn *string `type:"string"` - - // Information about the Amazon S3 bucket in which you want Elastic Transcoder - // to save transcoded files and playlists. Either you specify both ContentConfig - // and ThumbnailConfig, or you specify OutputBucket. - // - // * Bucket: The Amazon S3 bucket in which you want Elastic Transcoder to - // save transcoded files and playlists. - // - // * Permissions: A list of the users and/or predefined Amazon S3 groups - // you want to have access to transcoded files and playlists, and the type - // of access that you want them to have. - // - // GranteeType: The type of value that appears in the Grantee object: - // - // Canonical: Either the canonical user ID for an AWS account or an origin access - // identity for an Amazon CloudFront distribution. - // - // Email: The registered email address of an AWS account. - // - // Group: One of the following predefined Amazon S3 groups: AllUsers, AuthenticatedUsers, - // or LogDelivery. - // - // Grantee: The AWS user or group that you want to have access to transcoded - // files and playlists. - // - // Access: The permission that you want to give to the AWS user that is listed - // in Grantee. Valid values include: - // - // READ: The grantee can read the objects and metadata for objects that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // READ_ACP: The grantee can read the object ACL for objects that Elastic Transcoder - // adds to the Amazon S3 bucket. - // - // WRITE_ACP: The grantee can write the ACL for the objects that Elastic Transcoder - // adds to the Amazon S3 bucket. - // - // FULL_CONTROL: The grantee has READ, READ_ACP, and WRITE_ACP permissions for - // the objects that Elastic Transcoder adds to the Amazon S3 bucket. - // - // * StorageClass: The Amazon S3 storage class, Standard or ReducedRedundancy, - // that you want Elastic Transcoder to assign to the video files and playlists - // that it stores in your Amazon S3 bucket. - ContentConfig *PipelineOutputConfig `type:"structure"` - - // The identifier for the pipeline. You use this value to identify the pipeline - // in which you want to perform a variety of operations, such as creating a - // job or a preset. - Id *string `type:"string"` - - // The Amazon S3 bucket from which Elastic Transcoder gets media files for transcoding - // and the graphics files, if any, that you want to use for watermarks. - InputBucket *string `type:"string"` - - // The name of the pipeline. We recommend that the name be unique within the - // AWS account, but uniqueness is not enforced. - // - // Constraints: Maximum 40 characters - Name *string `min:"1" type:"string"` - - // The Amazon Simple Notification Service (Amazon SNS) topic that you want to - // notify to report job status. - // - // To receive notifications, you must also subscribe to the new topic in the - // Amazon SNS console. - // - // * Progressing (optional): The Amazon Simple Notification Service (Amazon - // SNS) topic that you want to notify when Elastic Transcoder has started - // to process the job. - // - // * Completed (optional): The Amazon SNS topic that you want to notify when - // Elastic Transcoder has finished processing the job. - // - // * Warning (optional): The Amazon SNS topic that you want to notify when - // Elastic Transcoder encounters a warning condition. - // - // * Error (optional): The Amazon SNS topic that you want to notify when - // Elastic Transcoder encounters an error condition. - Notifications *Notifications `type:"structure"` - - // The Amazon S3 bucket in which you want Elastic Transcoder to save transcoded - // files, thumbnails, and playlists. Either you specify this value, or you specify - // both ContentConfig and ThumbnailConfig. - OutputBucket *string `type:"string"` - - // The IAM Amazon Resource Name (ARN) for the role that Elastic Transcoder uses - // to transcode jobs for this pipeline. - Role *string `type:"string"` - - // The current status of the pipeline: - // - // * Active: The pipeline is processing jobs. - // - // * Paused: The pipeline is not currently processing jobs. - Status *string `type:"string"` - - // Information about the Amazon S3 bucket in which you want Elastic Transcoder - // to save thumbnail files. Either you specify both ContentConfig and ThumbnailConfig, - // or you specify OutputBucket. - // - // * Bucket: The Amazon S3 bucket in which you want Elastic Transcoder to - // save thumbnail files. - // - // * Permissions: A list of the users and/or predefined Amazon S3 groups - // you want to have access to thumbnail files, and the type of access that - // you want them to have. - // - // GranteeType: The type of value that appears in the Grantee object: - // - // Canonical: Either the canonical user ID for an AWS account or an origin access - // identity for an Amazon CloudFront distribution. - // - // A canonical user ID is not the same as an AWS account number. - // - // Email: The registered email address of an AWS account. - // - // Group: One of the following predefined Amazon S3 groups: AllUsers, AuthenticatedUsers, - // or LogDelivery. - // - // Grantee: The AWS user or group that you want to have access to thumbnail - // files. - // - // Access: The permission that you want to give to the AWS user that is listed - // in Grantee. Valid values include: - // - // READ: The grantee can read the thumbnails and metadata for thumbnails that - // Elastic Transcoder adds to the Amazon S3 bucket. - // - // READ_ACP: The grantee can read the object ACL for thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // WRITE_ACP: The grantee can write the ACL for the thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // FULL_CONTROL: The grantee has READ, READ_ACP, and WRITE_ACP permissions for - // the thumbnails that Elastic Transcoder adds to the Amazon S3 bucket. - // - // * StorageClass: The Amazon S3 storage class, Standard or ReducedRedundancy, - // that you want Elastic Transcoder to assign to the thumbnails that it stores - // in your Amazon S3 bucket. - ThumbnailConfig *PipelineOutputConfig `type:"structure"` -} - -// String returns the string representation -func (s Pipeline) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Pipeline) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *Pipeline) SetArn(v string) *Pipeline { - s.Arn = &v - return s -} - -// SetAwsKmsKeyArn sets the AwsKmsKeyArn field's value. -func (s *Pipeline) SetAwsKmsKeyArn(v string) *Pipeline { - s.AwsKmsKeyArn = &v - return s -} - -// SetContentConfig sets the ContentConfig field's value. -func (s *Pipeline) SetContentConfig(v *PipelineOutputConfig) *Pipeline { - s.ContentConfig = v - return s -} - -// SetId sets the Id field's value. -func (s *Pipeline) SetId(v string) *Pipeline { - s.Id = &v - return s -} - -// SetInputBucket sets the InputBucket field's value. -func (s *Pipeline) SetInputBucket(v string) *Pipeline { - s.InputBucket = &v - return s -} - -// SetName sets the Name field's value. -func (s *Pipeline) SetName(v string) *Pipeline { - s.Name = &v - return s -} - -// SetNotifications sets the Notifications field's value. -func (s *Pipeline) SetNotifications(v *Notifications) *Pipeline { - s.Notifications = v - return s -} - -// SetOutputBucket sets the OutputBucket field's value. -func (s *Pipeline) SetOutputBucket(v string) *Pipeline { - s.OutputBucket = &v - return s -} - -// SetRole sets the Role field's value. -func (s *Pipeline) SetRole(v string) *Pipeline { - s.Role = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *Pipeline) SetStatus(v string) *Pipeline { - s.Status = &v - return s -} - -// SetThumbnailConfig sets the ThumbnailConfig field's value. -func (s *Pipeline) SetThumbnailConfig(v *PipelineOutputConfig) *Pipeline { - s.ThumbnailConfig = v - return s -} - -// The PipelineOutputConfig structure. -type PipelineOutputConfig struct { - _ struct{} `type:"structure"` - - // The Amazon S3 bucket in which you want Elastic Transcoder to save the transcoded - // files. Specify this value when all of the following are true: - // - // * You want to save transcoded files, thumbnails (if any), and playlists - // (if any) together in one bucket. - // - // * You do not want to specify the users or groups who have access to the - // transcoded files, thumbnails, and playlists. - // - // * You do not want to specify the permissions that Elastic Transcoder grants - // to the files. - // - // * You want to associate the transcoded files and thumbnails with the Amazon - // S3 Standard storage class. - // - // If you want to save transcoded files and playlists in one bucket and thumbnails - // in another bucket, specify which users can access the transcoded files or - // the permissions the users have, or change the Amazon S3 storage class, omit - // OutputBucket and specify values for ContentConfig and ThumbnailConfig instead. - Bucket *string `type:"string"` - - // Optional. The Permissions object specifies which users and/or predefined - // Amazon S3 groups you want to have access to transcoded files and playlists, - // and the type of access you want them to have. You can grant permissions to - // a maximum of 30 users and/or predefined Amazon S3 groups. - // - // If you include Permissions, Elastic Transcoder grants only the permissions - // that you specify. It does not grant full permissions to the owner of the - // role specified by Role. If you want that user to have full control, you must - // explicitly grant full control to the user. - // - // If you omit Permissions, Elastic Transcoder grants full control over the - // transcoded files and playlists to the owner of the role specified by Role, - // and grants no other permissions to any other user or group. - Permissions []*Permission `type:"list"` - - // The Amazon S3 storage class, Standard or ReducedRedundancy, that you want - // Elastic Transcoder to assign to the video files and playlists that it stores - // in your Amazon S3 bucket. - StorageClass *string `type:"string"` -} - -// String returns the string representation -func (s PipelineOutputConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PipelineOutputConfig) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PipelineOutputConfig) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PipelineOutputConfig"} - if s.Permissions != nil { - for i, v := range s.Permissions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Permissions", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PipelineOutputConfig) SetBucket(v string) *PipelineOutputConfig { - s.Bucket = &v - return s -} - -// SetPermissions sets the Permissions field's value. -func (s *PipelineOutputConfig) SetPermissions(v []*Permission) *PipelineOutputConfig { - s.Permissions = v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *PipelineOutputConfig) SetStorageClass(v string) *PipelineOutputConfig { - s.StorageClass = &v - return s -} - -// The PlayReady DRM settings, if any, that you want Elastic Transcoder to apply -// to the output files associated with this playlist. -// -// PlayReady DRM encrypts your media files using AES-CTR encryption. -// -// If you use DRM for an HLSv3 playlist, your outputs must have a master playlist. -type PlayReadyDrm struct { - _ struct{} `type:"structure"` - - // The type of DRM, if any, that you want Elastic Transcoder to apply to the - // output files associated with this playlist. - Format *string `type:"string"` - - // The series of random bits created by a random bit generator, unique for every - // encryption operation, that you want Elastic Transcoder to use to encrypt - // your files. The initialization vector must be base64-encoded, and it must - // be exactly 8 bytes long before being base64-encoded. If no initialization - // vector is provided, Elastic Transcoder generates one for you. - InitializationVector *string `type:"string"` - - // The DRM key for your file, provided by your DRM license provider. The key - // must be base64-encoded, and it must be one of the following bit lengths before - // being base64-encoded: - // - // 128, 192, or 256. - // - // The key must also be encrypted by using AWS KMS. - Key *string `type:"string"` - - // The ID for your DRM key, so that your DRM license provider knows which key - // to provide. - // - // The key ID must be provided in big endian, and Elastic Transcoder converts - // it to little endian before inserting it into the PlayReady DRM headers. If - // you are unsure whether your license server provides your key ID in big or - // little endian, check with your DRM provider. - KeyId *string `type:"string"` - - // The MD5 digest of the key used for DRM on your file, and that you want Elastic - // Transcoder to use as a checksum to make sure your key was not corrupted in - // transit. The key MD5 must be base64-encoded, and it must be exactly 16 bytes - // before being base64-encoded. - KeyMd5 *string `type:"string"` - - // The location of the license key required to play DRM content. The URL must - // be an absolute path, and is referenced by the PlayReady header. The PlayReady - // header is referenced in the protection header of the client manifest for - // Smooth Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata - // tags for HLS playlist outputs. An example URL looks like this: https://www.example.com/exampleKey/ - LicenseAcquisitionUrl *string `min:"1" type:"string"` -} - -// String returns the string representation -func (s PlayReadyDrm) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PlayReadyDrm) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PlayReadyDrm) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PlayReadyDrm"} - if s.LicenseAcquisitionUrl != nil && len(*s.LicenseAcquisitionUrl) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LicenseAcquisitionUrl", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFormat sets the Format field's value. -func (s *PlayReadyDrm) SetFormat(v string) *PlayReadyDrm { - s.Format = &v - return s -} - -// SetInitializationVector sets the InitializationVector field's value. -func (s *PlayReadyDrm) SetInitializationVector(v string) *PlayReadyDrm { - s.InitializationVector = &v - return s -} - -// SetKey sets the Key field's value. -func (s *PlayReadyDrm) SetKey(v string) *PlayReadyDrm { - s.Key = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *PlayReadyDrm) SetKeyId(v string) *PlayReadyDrm { - s.KeyId = &v - return s -} - -// SetKeyMd5 sets the KeyMd5 field's value. -func (s *PlayReadyDrm) SetKeyMd5(v string) *PlayReadyDrm { - s.KeyMd5 = &v - return s -} - -// SetLicenseAcquisitionUrl sets the LicenseAcquisitionUrl field's value. -func (s *PlayReadyDrm) SetLicenseAcquisitionUrl(v string) *PlayReadyDrm { - s.LicenseAcquisitionUrl = &v - return s -} - -// Use Only for Fragmented MP4 or MPEG-TS Outputs. If you specify a preset for -// which the value of Container is fmp4 (Fragmented MP4) or ts (MPEG-TS), Playlists -// contains information about the master playlists that you want Elastic Transcoder -// to create. We recommend that you create only one master playlist per output -// format. The maximum number of master playlists in a job is 30. -type Playlist struct { - _ struct{} `type:"structure"` - - // The format of the output playlist. Valid formats include HLSv3, HLSv4, and - // Smooth. - Format *string `type:"string"` - - // The HLS content protection settings, if any, that you want Elastic Transcoder - // to apply to the output files associated with this playlist. - HlsContentProtection *HlsContentProtection `type:"structure"` - - // The name that you want Elastic Transcoder to assign to the master playlist, - // for example, nyc-vacation.m3u8. If the name includes a / character, the section - // of the name before the last / must be identical for all Name objects. If - // you create more than one master playlist, the values of all Name objects - // must be unique. - // - // Elastic Transcoder automatically appends the relevant file extension to the - // file name (.m3u8 for HLSv3 and HLSv4 playlists, and .ism and .ismc for Smooth - // playlists). If you include a file extension in Name, the file name will have - // two extensions. - Name *string `min:"1" type:"string"` - - // For each output in this job that you want to include in a master playlist, - // the value of the Outputs:Key object. - // - // * If your output is not HLS or does not have a segment duration set, the - // name of the output file is a concatenation of OutputKeyPrefix and Outputs:Key: - // - // OutputKeyPrefixOutputs:Key - // - // * If your output is HLSv3 and has a segment duration set, or is not included - // in a playlist, Elastic Transcoder creates an output playlist file with - // a file extension of .m3u8, and a series of .ts files that include a five-digit - // sequential counter beginning with 00000: - // - // OutputKeyPrefixOutputs:Key.m3u8 - // - // OutputKeyPrefixOutputs:Key00000.ts - // - // * If your output is HLSv4, has a segment duration set, and is included - // in an HLSv4 playlist, Elastic Transcoder creates an output playlist file - // with a file extension of _v4.m3u8. If the output is video, Elastic Transcoder - // also creates an output file with an extension of _iframe.m3u8: - // - // OutputKeyPrefixOutputs:Key_v4.m3u8 - // - // OutputKeyPrefixOutputs:Key_iframe.m3u8 - // - // OutputKeyPrefixOutputs:Key.ts - // - // Elastic Transcoder automatically appends the relevant file extension to the - // file name. If you include a file extension in Output Key, the file name will - // have two extensions. - // - // If you include more than one output in a playlist, any segment duration settings, - // clip settings, or caption settings must be the same for all outputs in the - // playlist. For Smooth playlists, the Audio:Profile, Video:Profile, and Video:FrameRate - // to Video:KeyframesMaxDist ratio must be the same for all outputs. - OutputKeys []*string `type:"list"` - - // The DRM settings, if any, that you want Elastic Transcoder to apply to the - // output files associated with this playlist. - PlayReadyDrm *PlayReadyDrm `type:"structure"` - - // The status of the job with which the playlist is associated. - Status *string `type:"string"` - - // Information that further explains the status. - StatusDetail *string `type:"string"` -} - -// String returns the string representation -func (s Playlist) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Playlist) GoString() string { - return s.String() -} - -// SetFormat sets the Format field's value. -func (s *Playlist) SetFormat(v string) *Playlist { - s.Format = &v - return s -} - -// SetHlsContentProtection sets the HlsContentProtection field's value. -func (s *Playlist) SetHlsContentProtection(v *HlsContentProtection) *Playlist { - s.HlsContentProtection = v - return s -} - -// SetName sets the Name field's value. -func (s *Playlist) SetName(v string) *Playlist { - s.Name = &v - return s -} - -// SetOutputKeys sets the OutputKeys field's value. -func (s *Playlist) SetOutputKeys(v []*string) *Playlist { - s.OutputKeys = v - return s -} - -// SetPlayReadyDrm sets the PlayReadyDrm field's value. -func (s *Playlist) SetPlayReadyDrm(v *PlayReadyDrm) *Playlist { - s.PlayReadyDrm = v - return s -} - -// SetStatus sets the Status field's value. -func (s *Playlist) SetStatus(v string) *Playlist { - s.Status = &v - return s -} - -// SetStatusDetail sets the StatusDetail field's value. -func (s *Playlist) SetStatusDetail(v string) *Playlist { - s.StatusDetail = &v - return s -} - -// Presets are templates that contain most of the settings for transcoding media -// files from one format to another. Elastic Transcoder includes some default -// presets for common formats, for example, several iPod and iPhone versions. -// You can also create your own presets for formats that aren't included among -// the default presets. You specify which preset you want to use when you create -// a job. -type Preset struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) for the preset. - Arn *string `type:"string"` - - // A section of the response body that provides information about the audio - // preset values. - Audio *AudioParameters `type:"structure"` - - // The container type for the output file. Valid values include flac, flv, fmp4, - // gif, mp3, mp4, mpg, mxf, oga, ogg, ts, and webm. - Container *string `type:"string"` - - // A description of the preset. - Description *string `type:"string"` - - // Identifier for the new preset. You use this value to get settings for the - // preset or to delete it. - Id *string `type:"string"` - - // The name of the preset. - Name *string `min:"1" type:"string"` - - // A section of the response body that provides information about the thumbnail - // preset values, if any. - Thumbnails *Thumbnails `type:"structure"` - - // Whether the preset is a default preset provided by Elastic Transcoder (System) - // or a preset that you have defined (Custom). - Type *string `type:"string"` - - // A section of the response body that provides information about the video - // preset values. - Video *VideoParameters `type:"structure"` -} - -// String returns the string representation -func (s Preset) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Preset) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *Preset) SetArn(v string) *Preset { - s.Arn = &v - return s -} - -// SetAudio sets the Audio field's value. -func (s *Preset) SetAudio(v *AudioParameters) *Preset { - s.Audio = v - return s -} - -// SetContainer sets the Container field's value. -func (s *Preset) SetContainer(v string) *Preset { - s.Container = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *Preset) SetDescription(v string) *Preset { - s.Description = &v - return s -} - -// SetId sets the Id field's value. -func (s *Preset) SetId(v string) *Preset { - s.Id = &v - return s -} - -// SetName sets the Name field's value. -func (s *Preset) SetName(v string) *Preset { - s.Name = &v - return s -} - -// SetThumbnails sets the Thumbnails field's value. -func (s *Preset) SetThumbnails(v *Thumbnails) *Preset { - s.Thumbnails = v - return s -} - -// SetType sets the Type field's value. -func (s *Preset) SetType(v string) *Preset { - s.Type = &v - return s -} - -// SetVideo sets the Video field's value. -func (s *Preset) SetVideo(v *VideoParameters) *Preset { - s.Video = v - return s -} - -// Settings for the size, location, and opacity of graphics that you want Elastic -// Transcoder to overlay over videos that are transcoded using this preset. -// You can specify settings for up to four watermarks. Watermarks appear in -// the specified size and location, and with the specified opacity for the duration -// of the transcoded video. -// -// Watermarks can be in .png or .jpg format. If you want to display a watermark -// that is not rectangular, use the .png format, which supports transparency. -// -// When you create a job that uses this preset, you specify the .png or .jpg -// graphics that you want Elastic Transcoder to include in the transcoded videos. -// You can specify fewer graphics in the job than you specify watermark settings -// in the preset, which allows you to use the same preset for up to four watermarks -// that have different dimensions. -type PresetWatermark struct { - _ struct{} `type:"structure"` - - // The horizontal position of the watermark unless you specify a non-zero value - // for HorizontalOffset: - // - // * Left: The left edge of the watermark is aligned with the left border - // of the video. - // - // * Right: The right edge of the watermark is aligned with the right border - // of the video. - // - // * Center: The watermark is centered between the left and right borders. - HorizontalAlign *string `type:"string"` - - // The amount by which you want the horizontal position of the watermark to - // be offset from the position specified by HorizontalAlign: - // - // * number of pixels (px): The minimum value is 0 pixels, and the maximum - // value is the value of MaxWidth. - // - // * integer percentage (%): The range of valid values is 0 to 100. - // - // For example, if you specify Left for HorizontalAlign and 5px for HorizontalOffset, - // the left side of the watermark appears 5 pixels from the left border of the - // output video. - // - // HorizontalOffset is only valid when the value of HorizontalAlign is Left - // or Right. If you specify an offset that causes the watermark to extend beyond - // the left or right border and Elastic Transcoder has not added black bars, - // the watermark is cropped. If Elastic Transcoder has added black bars, the - // watermark extends into the black bars. If the watermark extends beyond the - // black bars, it is cropped. - // - // Use the value of Target to specify whether you want to include the black - // bars that are added by Elastic Transcoder, if any, in the offset calculation. - HorizontalOffset *string `type:"string"` - - // A unique identifier for the settings for one watermark. The value of Id can - // be up to 40 characters long. - Id *string `min:"1" type:"string"` - - // The maximum height of the watermark in one of the following formats: - // - // * number of pixels (px): The minimum value is 16 pixels, and the maximum - // value is the value of MaxHeight. - // - // * integer percentage (%): The range of valid values is 0 to 100. Use the - // value of Target to specify whether you want Elastic Transcoder to include - // the black bars that are added by Elastic Transcoder, if any, in the calculation. - // - // If you specify the value in pixels, it must be less than or equal to the - // value of MaxHeight. - MaxHeight *string `type:"string"` - - // The maximum width of the watermark in one of the following formats: - // - // * number of pixels (px): The minimum value is 16 pixels, and the maximum - // value is the value of MaxWidth. - // - // * integer percentage (%): The range of valid values is 0 to 100. Use the - // value of Target to specify whether you want Elastic Transcoder to include - // the black bars that are added by Elastic Transcoder, if any, in the calculation. - // - // If you specify the value in pixels, it must be less than or equal to the - // value of MaxWidth. - MaxWidth *string `type:"string"` - - // A percentage that indicates how much you want a watermark to obscure the - // video in the location where it appears. Valid values are 0 (the watermark - // is invisible) to 100 (the watermark completely obscures the video in the - // specified location). The datatype of Opacity is float. - // - // Elastic Transcoder supports transparent .png graphics. If you use a transparent - // .png, the transparent portion of the video appears as if you had specified - // a value of 0 for Opacity. The .jpg file format doesn't support transparency. - Opacity *string `type:"string"` - - // A value that controls scaling of the watermark: - // - // * Fit: Elastic Transcoder scales the watermark so it matches the value - // that you specified in either MaxWidth or MaxHeight without exceeding the - // other value. - // - // * Stretch: Elastic Transcoder stretches the watermark to match the values - // that you specified for MaxWidth and MaxHeight. If the relative proportions - // of the watermark and the values of MaxWidth and MaxHeight are different, - // the watermark will be distorted. - // - // * ShrinkToFit: Elastic Transcoder scales the watermark down so that its - // dimensions match the values that you specified for at least one of MaxWidth - // and MaxHeight without exceeding either value. If you specify this option, - // Elastic Transcoder does not scale the watermark up. - SizingPolicy *string `type:"string"` - - // A value that determines how Elastic Transcoder interprets values that you - // specified for HorizontalOffset, VerticalOffset, MaxWidth, and MaxHeight: - // - // * Content: HorizontalOffset and VerticalOffset values are calculated based - // on the borders of the video excluding black bars added by Elastic Transcoder, - // if any. In addition, MaxWidth and MaxHeight, if specified as a percentage, - // are calculated based on the borders of the video excluding black bars - // added by Elastic Transcoder, if any. - // - // * Frame: HorizontalOffset and VerticalOffset values are calculated based - // on the borders of the video including black bars added by Elastic Transcoder, - // if any. In addition, MaxWidth and MaxHeight, if specified as a percentage, - // are calculated based on the borders of the video including black bars - // added by Elastic Transcoder, if any. - Target *string `type:"string"` - - // The vertical position of the watermark unless you specify a non-zero value - // for VerticalOffset: - // - // * Top: The top edge of the watermark is aligned with the top border of - // the video. - // - // * Bottom: The bottom edge of the watermark is aligned with the bottom - // border of the video. - // - // * Center: The watermark is centered between the top and bottom borders. - VerticalAlign *string `type:"string"` - - // VerticalOffset - // - // The amount by which you want the vertical position of the watermark to be - // offset from the position specified by VerticalAlign: - // - // * number of pixels (px): The minimum value is 0 pixels, and the maximum - // value is the value of MaxHeight. - // - // * integer percentage (%): The range of valid values is 0 to 100. - // - // For example, if you specify Top for VerticalAlign and 5px for VerticalOffset, - // the top of the watermark appears 5 pixels from the top border of the output - // video. - // - // VerticalOffset is only valid when the value of VerticalAlign is Top or Bottom. - // - // If you specify an offset that causes the watermark to extend beyond the top - // or bottom border and Elastic Transcoder has not added black bars, the watermark - // is cropped. If Elastic Transcoder has added black bars, the watermark extends - // into the black bars. If the watermark extends beyond the black bars, it is - // cropped. - // - // Use the value of Target to specify whether you want Elastic Transcoder to - // include the black bars that are added by Elastic Transcoder, if any, in the - // offset calculation. - VerticalOffset *string `type:"string"` -} - -// String returns the string representation -func (s PresetWatermark) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PresetWatermark) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PresetWatermark) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PresetWatermark"} - if s.Id != nil && len(*s.Id) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Id", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHorizontalAlign sets the HorizontalAlign field's value. -func (s *PresetWatermark) SetHorizontalAlign(v string) *PresetWatermark { - s.HorizontalAlign = &v - return s -} - -// SetHorizontalOffset sets the HorizontalOffset field's value. -func (s *PresetWatermark) SetHorizontalOffset(v string) *PresetWatermark { - s.HorizontalOffset = &v - return s -} - -// SetId sets the Id field's value. -func (s *PresetWatermark) SetId(v string) *PresetWatermark { - s.Id = &v - return s -} - -// SetMaxHeight sets the MaxHeight field's value. -func (s *PresetWatermark) SetMaxHeight(v string) *PresetWatermark { - s.MaxHeight = &v - return s -} - -// SetMaxWidth sets the MaxWidth field's value. -func (s *PresetWatermark) SetMaxWidth(v string) *PresetWatermark { - s.MaxWidth = &v - return s -} - -// SetOpacity sets the Opacity field's value. -func (s *PresetWatermark) SetOpacity(v string) *PresetWatermark { - s.Opacity = &v - return s -} - -// SetSizingPolicy sets the SizingPolicy field's value. -func (s *PresetWatermark) SetSizingPolicy(v string) *PresetWatermark { - s.SizingPolicy = &v - return s -} - -// SetTarget sets the Target field's value. -func (s *PresetWatermark) SetTarget(v string) *PresetWatermark { - s.Target = &v - return s -} - -// SetVerticalAlign sets the VerticalAlign field's value. -func (s *PresetWatermark) SetVerticalAlign(v string) *PresetWatermark { - s.VerticalAlign = &v - return s -} - -// SetVerticalOffset sets the VerticalOffset field's value. -func (s *PresetWatermark) SetVerticalOffset(v string) *PresetWatermark { - s.VerticalOffset = &v - return s -} - -// The ReadJobRequest structure. -type ReadJobInput struct { - _ struct{} `type:"structure"` - - // The identifier of the job for which you want to get detailed information. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` -} - -// String returns the string representation -func (s ReadJobInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReadJobInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReadJobInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReadJobInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *ReadJobInput) SetId(v string) *ReadJobInput { - s.Id = &v - return s -} - -// The ReadJobResponse structure. -type ReadJobOutput struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the job. - Job *Job `type:"structure"` -} - -// String returns the string representation -func (s ReadJobOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReadJobOutput) GoString() string { - return s.String() -} - -// SetJob sets the Job field's value. -func (s *ReadJobOutput) SetJob(v *Job) *ReadJobOutput { - s.Job = v - return s -} - -// The ReadPipelineRequest structure. -type ReadPipelineInput struct { - _ struct{} `type:"structure"` - - // The identifier of the pipeline to read. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` -} - -// String returns the string representation -func (s ReadPipelineInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReadPipelineInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReadPipelineInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReadPipelineInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *ReadPipelineInput) SetId(v string) *ReadPipelineInput { - s.Id = &v - return s -} - -// The ReadPipelineResponse structure. -type ReadPipelineOutput struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the pipeline. - Pipeline *Pipeline `type:"structure"` - - // Elastic Transcoder returns a warning if the resources used by your pipeline - // are not in the same region as the pipeline. - // - // Using resources in the same region, such as your Amazon S3 buckets, Amazon - // SNS notification topics, and AWS KMS key, reduces processing time and prevents - // cross-regional charges. - Warnings []*Warning `type:"list"` -} - -// String returns the string representation -func (s ReadPipelineOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReadPipelineOutput) GoString() string { - return s.String() -} - -// SetPipeline sets the Pipeline field's value. -func (s *ReadPipelineOutput) SetPipeline(v *Pipeline) *ReadPipelineOutput { - s.Pipeline = v - return s -} - -// SetWarnings sets the Warnings field's value. -func (s *ReadPipelineOutput) SetWarnings(v []*Warning) *ReadPipelineOutput { - s.Warnings = v - return s -} - -// The ReadPresetRequest structure. -type ReadPresetInput struct { - _ struct{} `type:"structure"` - - // The identifier of the preset for which you want to get detailed information. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` -} - -// String returns the string representation -func (s ReadPresetInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReadPresetInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReadPresetInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReadPresetInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *ReadPresetInput) SetId(v string) *ReadPresetInput { - s.Id = &v - return s -} - -// The ReadPresetResponse structure. -type ReadPresetOutput struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the preset. - Preset *Preset `type:"structure"` -} - -// String returns the string representation -func (s ReadPresetOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReadPresetOutput) GoString() string { - return s.String() -} - -// SetPreset sets the Preset field's value. -func (s *ReadPresetOutput) SetPreset(v *Preset) *ReadPresetOutput { - s.Preset = v - return s -} - -// The TestRoleRequest structure. -type TestRoleInput struct { - _ struct{} `deprecated:"true" type:"structure"` - - // The Amazon S3 bucket that contains media files to be transcoded. The action - // attempts to read from this bucket. - // - // InputBucket is a required field - InputBucket *string `type:"string" required:"true"` - - // The Amazon S3 bucket that Elastic Transcoder writes transcoded media files - // to. The action attempts to read from this bucket. - // - // OutputBucket is a required field - OutputBucket *string `type:"string" required:"true"` - - // The IAM Amazon Resource Name (ARN) for the role that you want Elastic Transcoder - // to test. - // - // Role is a required field - Role *string `type:"string" required:"true"` - - // The ARNs of one or more Amazon Simple Notification Service (Amazon SNS) topics - // that you want the action to send a test notification to. - // - // Topics is a required field - Topics []*string `type:"list" required:"true"` -} - -// String returns the string representation -func (s TestRoleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TestRoleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TestRoleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TestRoleInput"} - if s.InputBucket == nil { - invalidParams.Add(request.NewErrParamRequired("InputBucket")) - } - if s.OutputBucket == nil { - invalidParams.Add(request.NewErrParamRequired("OutputBucket")) - } - if s.Role == nil { - invalidParams.Add(request.NewErrParamRequired("Role")) - } - if s.Topics == nil { - invalidParams.Add(request.NewErrParamRequired("Topics")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInputBucket sets the InputBucket field's value. -func (s *TestRoleInput) SetInputBucket(v string) *TestRoleInput { - s.InputBucket = &v - return s -} - -// SetOutputBucket sets the OutputBucket field's value. -func (s *TestRoleInput) SetOutputBucket(v string) *TestRoleInput { - s.OutputBucket = &v - return s -} - -// SetRole sets the Role field's value. -func (s *TestRoleInput) SetRole(v string) *TestRoleInput { - s.Role = &v - return s -} - -// SetTopics sets the Topics field's value. -func (s *TestRoleInput) SetTopics(v []*string) *TestRoleInput { - s.Topics = v - return s -} - -// The TestRoleResponse structure. -type TestRoleOutput struct { - _ struct{} `deprecated:"true" type:"structure"` - - // If the Success element contains false, this value is an array of one or more - // error messages that were generated during the test process. - Messages []*string `type:"list"` - - // If the operation is successful, this value is true; otherwise, the value - // is false. - Success *string `type:"string"` -} - -// String returns the string representation -func (s TestRoleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TestRoleOutput) GoString() string { - return s.String() -} - -// SetMessages sets the Messages field's value. -func (s *TestRoleOutput) SetMessages(v []*string) *TestRoleOutput { - s.Messages = v - return s -} - -// SetSuccess sets the Success field's value. -func (s *TestRoleOutput) SetSuccess(v string) *TestRoleOutput { - s.Success = &v - return s -} - -// Thumbnails for videos. -type Thumbnails struct { - _ struct{} `type:"structure"` - - // To better control resolution and aspect ratio of thumbnails, we recommend - // that you use the values MaxWidth, MaxHeight, SizingPolicy, and PaddingPolicy - // instead of Resolution and AspectRatio. The two groups of settings are mutually - // exclusive. Do not use them together. - // - // The aspect ratio of thumbnails. Valid values include: - // - // auto, 1:1, 4:3, 3:2, 16:9 - // - // If you specify auto, Elastic Transcoder tries to preserve the aspect ratio - // of the video in the output file. - AspectRatio *string `type:"string"` - - // The format of thumbnails, if any. Valid values are jpg and png. - // - // You specify whether you want Elastic Transcoder to create thumbnails when - // you create a job. - Format *string `type:"string"` - - // The approximate number of seconds between thumbnails. Specify an integer - // value. - Interval *string `type:"string"` - - // The maximum height of thumbnails in pixels. If you specify auto, Elastic - // Transcoder uses 1080 (Full HD) as the default value. If you specify a numeric - // value, enter an even integer between 32 and 3072. - MaxHeight *string `type:"string"` - - // The maximum width of thumbnails in pixels. If you specify auto, Elastic Transcoder - // uses 1920 (Full HD) as the default value. If you specify a numeric value, - // enter an even integer between 32 and 4096. - MaxWidth *string `type:"string"` - - // When you set PaddingPolicy to Pad, Elastic Transcoder may add black bars - // to the top and bottom and/or left and right sides of thumbnails to make the - // total size of the thumbnails match the values that you specified for thumbnail - // MaxWidth and MaxHeight settings. - PaddingPolicy *string `type:"string"` - - // To better control resolution and aspect ratio of thumbnails, we recommend - // that you use the values MaxWidth, MaxHeight, SizingPolicy, and PaddingPolicy - // instead of Resolution and AspectRatio. The two groups of settings are mutually - // exclusive. Do not use them together. - // - // The width and height of thumbnail files in pixels. Specify a value in the - // format width x height where both values are even integers. The values cannot - // exceed the width and height that you specified in the Video:Resolution object. - Resolution *string `type:"string"` - - // Specify one of the following values to control scaling of thumbnails: - // - // * Fit: Elastic Transcoder scales thumbnails so they match the value that - // you specified in thumbnail MaxWidth or MaxHeight settings without exceeding - // the other value. - // - // * Fill: Elastic Transcoder scales thumbnails so they match the value that - // you specified in thumbnail MaxWidth or MaxHeight settings and matches - // or exceeds the other value. Elastic Transcoder centers the image in thumbnails - // and then crops in the dimension (if any) that exceeds the maximum value. - // - // * Stretch: Elastic Transcoder stretches thumbnails to match the values - // that you specified for thumbnail MaxWidth and MaxHeight settings. If the - // relative proportions of the input video and thumbnails are different, - // the thumbnails will be distorted. - // - // * Keep: Elastic Transcoder does not scale thumbnails. If either dimension - // of the input video exceeds the values that you specified for thumbnail - // MaxWidth and MaxHeight settings, Elastic Transcoder crops the thumbnails. - // - // * ShrinkToFit: Elastic Transcoder scales thumbnails down so that their - // dimensions match the values that you specified for at least one of thumbnail - // MaxWidth and MaxHeight without exceeding either value. If you specify - // this option, Elastic Transcoder does not scale thumbnails up. - // - // * ShrinkToFill: Elastic Transcoder scales thumbnails down so that their - // dimensions match the values that you specified for at least one of MaxWidth - // and MaxHeight without dropping below either value. If you specify this - // option, Elastic Transcoder does not scale thumbnails up. - SizingPolicy *string `type:"string"` -} - -// String returns the string representation -func (s Thumbnails) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Thumbnails) GoString() string { - return s.String() -} - -// SetAspectRatio sets the AspectRatio field's value. -func (s *Thumbnails) SetAspectRatio(v string) *Thumbnails { - s.AspectRatio = &v - return s -} - -// SetFormat sets the Format field's value. -func (s *Thumbnails) SetFormat(v string) *Thumbnails { - s.Format = &v - return s -} - -// SetInterval sets the Interval field's value. -func (s *Thumbnails) SetInterval(v string) *Thumbnails { - s.Interval = &v - return s -} - -// SetMaxHeight sets the MaxHeight field's value. -func (s *Thumbnails) SetMaxHeight(v string) *Thumbnails { - s.MaxHeight = &v - return s -} - -// SetMaxWidth sets the MaxWidth field's value. -func (s *Thumbnails) SetMaxWidth(v string) *Thumbnails { - s.MaxWidth = &v - return s -} - -// SetPaddingPolicy sets the PaddingPolicy field's value. -func (s *Thumbnails) SetPaddingPolicy(v string) *Thumbnails { - s.PaddingPolicy = &v - return s -} - -// SetResolution sets the Resolution field's value. -func (s *Thumbnails) SetResolution(v string) *Thumbnails { - s.Resolution = &v - return s -} - -// SetSizingPolicy sets the SizingPolicy field's value. -func (s *Thumbnails) SetSizingPolicy(v string) *Thumbnails { - s.SizingPolicy = &v - return s -} - -// Settings that determine when a clip begins and how long it lasts. -type TimeSpan struct { - _ struct{} `type:"structure"` - - // The duration of the clip. The format can be either HH:mm:ss.SSS (maximum - // value: 23:59:59.999; SSS is thousandths of a second) or sssss.SSS (maximum - // value: 86399.999). If you don't specify a value, Elastic Transcoder creates - // an output file from StartTime to the end of the file. - // - // If you specify a value longer than the duration of the input file, Elastic - // Transcoder transcodes the file and returns a warning message. - Duration *string `type:"string"` - - // The place in the input file where you want a clip to start. The format can - // be either HH:mm:ss.SSS (maximum value: 23:59:59.999; SSS is thousandths of - // a second) or sssss.SSS (maximum value: 86399.999). If you don't specify a - // value, Elastic Transcoder starts at the beginning of the input file. - StartTime *string `type:"string"` -} - -// String returns the string representation -func (s TimeSpan) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TimeSpan) GoString() string { - return s.String() -} - -// SetDuration sets the Duration field's value. -func (s *TimeSpan) SetDuration(v string) *TimeSpan { - s.Duration = &v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *TimeSpan) SetStartTime(v string) *TimeSpan { - s.StartTime = &v - return s -} - -// Details about the timing of a job. -type Timing struct { - _ struct{} `type:"structure"` - - // The time the job finished transcoding, in epoch milliseconds. - FinishTimeMillis *int64 `type:"long"` - - // The time the job began transcoding, in epoch milliseconds. - StartTimeMillis *int64 `type:"long"` - - // The time the job was submitted to Elastic Transcoder, in epoch milliseconds. - SubmitTimeMillis *int64 `type:"long"` -} - -// String returns the string representation -func (s Timing) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Timing) GoString() string { - return s.String() -} - -// SetFinishTimeMillis sets the FinishTimeMillis field's value. -func (s *Timing) SetFinishTimeMillis(v int64) *Timing { - s.FinishTimeMillis = &v - return s -} - -// SetStartTimeMillis sets the StartTimeMillis field's value. -func (s *Timing) SetStartTimeMillis(v int64) *Timing { - s.StartTimeMillis = &v - return s -} - -// SetSubmitTimeMillis sets the SubmitTimeMillis field's value. -func (s *Timing) SetSubmitTimeMillis(v int64) *Timing { - s.SubmitTimeMillis = &v - return s -} - -// The UpdatePipelineRequest structure. -type UpdatePipelineInput struct { - _ struct{} `type:"structure"` - - // The AWS Key Management Service (AWS KMS) key that you want to use with this - // pipeline. - // - // If you use either S3 or S3-AWS-KMS as your Encryption:Mode, you don't need - // to provide a key with your job because a default key, known as an AWS-KMS - // key, is created for you automatically. You need to provide an AWS-KMS key - // only if you want to use a non-default AWS-KMS key, or if you are using an - // Encryption:Mode of AES-PKCS7, AES-CTR, or AES-GCM. - AwsKmsKeyArn *string `type:"string"` - - // The optional ContentConfig object specifies information about the Amazon - // S3 bucket in which you want Elastic Transcoder to save transcoded files and - // playlists: which bucket to use, which users you want to have access to the - // files, the type of access you want users to have, and the storage class that - // you want to assign to the files. - // - // If you specify values for ContentConfig, you must also specify values for - // ThumbnailConfig. - // - // If you specify values for ContentConfig and ThumbnailConfig, omit the OutputBucket - // object. - // - // * Bucket: The Amazon S3 bucket in which you want Elastic Transcoder to - // save transcoded files and playlists. - // - // * Permissions (Optional): The Permissions object specifies which users - // you want to have access to transcoded files and the type of access you - // want them to have. You can grant permissions to a maximum of 30 users - // and/or predefined Amazon S3 groups. - // - // * Grantee Type: Specify the type of value that appears in the Grantee - // object: - // - // Canonical: The value in the Grantee object is either the canonical user ID - // for an AWS account or an origin access identity for an Amazon CloudFront - // distribution. For more information about canonical user IDs, see Access - // Control List (ACL) Overview in the Amazon Simple Storage Service Developer - // Guide. For more information about using CloudFront origin access identities - // to require that users use CloudFront URLs instead of Amazon S3 URLs, see - // Using an Origin Access Identity to Restrict Access to Your Amazon S3 Content. - // - // A canonical user ID is not the same as an AWS account number. - // - // Email: The value in the Grantee object is the registered email address of - // an AWS account. - // - // Group: The value in the Grantee object is one of the following predefined - // Amazon S3 groups: AllUsers, AuthenticatedUsers, or LogDelivery. - // - // * Grantee: The AWS user or group that you want to have access to transcoded - // files and playlists. To identify the user or group, you can specify the - // canonical user ID for an AWS account, an origin access identity for a - // CloudFront distribution, the registered email address of an AWS account, - // or a predefined Amazon S3 group - // - // * Access: The permission that you want to give to the AWS user that you - // specified in Grantee. Permissions are granted on the files that Elastic - // Transcoder adds to the bucket, including playlists and video files. Valid - // values include: - // - // READ: The grantee can read the objects and metadata for objects that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // READ_ACP: The grantee can read the object ACL for objects that Elastic Transcoder - // adds to the Amazon S3 bucket. - // - // WRITE_ACP: The grantee can write the ACL for the objects that Elastic Transcoder - // adds to the Amazon S3 bucket. - // - // FULL_CONTROL: The grantee has READ, READ_ACP, and WRITE_ACP permissions for - // the objects that Elastic Transcoder adds to the Amazon S3 bucket. - // - // * StorageClass: The Amazon S3 storage class, Standard or ReducedRedundancy, - // that you want Elastic Transcoder to assign to the video files and playlists - // that it stores in your Amazon S3 bucket. - ContentConfig *PipelineOutputConfig `type:"structure"` - - // The ID of the pipeline that you want to update. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` - - // The Amazon S3 bucket in which you saved the media files that you want to - // transcode and the graphics that you want to use as watermarks. - InputBucket *string `type:"string"` - - // The name of the pipeline. We recommend that the name be unique within the - // AWS account, but uniqueness is not enforced. - // - // Constraints: Maximum 40 characters - Name *string `min:"1" type:"string"` - - // The topic ARN for the Amazon Simple Notification Service (Amazon SNS) topic - // that you want to notify to report job status. - // - // To receive notifications, you must also subscribe to the new topic in the - // Amazon SNS console. - // - // * Progressing: The topic ARN for the Amazon Simple Notification Service - // (Amazon SNS) topic that you want to notify when Elastic Transcoder has - // started to process jobs that are added to this pipeline. This is the ARN - // that Amazon SNS returned when you created the topic. - // - // * Completed: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder has finished processing a job. This is the ARN - // that Amazon SNS returned when you created the topic. - // - // * Warning: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder encounters a warning condition. This is the ARN - // that Amazon SNS returned when you created the topic. - // - // * Error: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder encounters an error condition. This is the ARN - // that Amazon SNS returned when you created the topic. - Notifications *Notifications `type:"structure"` - - // The IAM Amazon Resource Name (ARN) for the role that you want Elastic Transcoder - // to use to transcode jobs for this pipeline. - Role *string `type:"string"` - - // The ThumbnailConfig object specifies several values, including the Amazon - // S3 bucket in which you want Elastic Transcoder to save thumbnail files, which - // users you want to have access to the files, the type of access you want users - // to have, and the storage class that you want to assign to the files. - // - // If you specify values for ContentConfig, you must also specify values for - // ThumbnailConfig even if you don't want to create thumbnails. - // - // If you specify values for ContentConfig and ThumbnailConfig, omit the OutputBucket - // object. - // - // * Bucket: The Amazon S3 bucket in which you want Elastic Transcoder to - // save thumbnail files. - // - // * Permissions (Optional): The Permissions object specifies which users - // and/or predefined Amazon S3 groups you want to have access to thumbnail - // files, and the type of access you want them to have. You can grant permissions - // to a maximum of 30 users and/or predefined Amazon S3 groups. - // - // * GranteeType: Specify the type of value that appears in the Grantee object: - // - // Canonical: The value in the Grantee object is either the canonical user ID - // for an AWS account or an origin access identity for an Amazon CloudFront - // distribution. - // - // A canonical user ID is not the same as an AWS account number. - // - // Email: The value in the Grantee object is the registered email address of - // an AWS account. - // - // Group: The value in the Grantee object is one of the following predefined - // Amazon S3 groups: AllUsers, AuthenticatedUsers, or LogDelivery. - // - // * Grantee: The AWS user or group that you want to have access to thumbnail - // files. To identify the user or group, you can specify the canonical user - // ID for an AWS account, an origin access identity for a CloudFront distribution, - // the registered email address of an AWS account, or a predefined Amazon - // S3 group. - // - // * Access: The permission that you want to give to the AWS user that you - // specified in Grantee. Permissions are granted on the thumbnail files that - // Elastic Transcoder adds to the bucket. Valid values include: - // - // READ: The grantee can read the thumbnails and metadata for objects that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // READ_ACP: The grantee can read the object ACL for thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // WRITE_ACP: The grantee can write the ACL for the thumbnails that Elastic - // Transcoder adds to the Amazon S3 bucket. - // - // FULL_CONTROL: The grantee has READ, READ_ACP, and WRITE_ACP permissions for - // the thumbnails that Elastic Transcoder adds to the Amazon S3 bucket. - // - // * StorageClass: The Amazon S3 storage class, Standard or ReducedRedundancy, - // that you want Elastic Transcoder to assign to the thumbnails that it stores - // in your Amazon S3 bucket. - ThumbnailConfig *PipelineOutputConfig `type:"structure"` -} - -// String returns the string representation -func (s UpdatePipelineInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UpdatePipelineInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdatePipelineInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdatePipelineInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } - if s.ContentConfig != nil { - if err := s.ContentConfig.Validate(); err != nil { - invalidParams.AddNested("ContentConfig", err.(request.ErrInvalidParams)) - } - } - if s.ThumbnailConfig != nil { - if err := s.ThumbnailConfig.Validate(); err != nil { - invalidParams.AddNested("ThumbnailConfig", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAwsKmsKeyArn sets the AwsKmsKeyArn field's value. -func (s *UpdatePipelineInput) SetAwsKmsKeyArn(v string) *UpdatePipelineInput { - s.AwsKmsKeyArn = &v - return s -} - -// SetContentConfig sets the ContentConfig field's value. -func (s *UpdatePipelineInput) SetContentConfig(v *PipelineOutputConfig) *UpdatePipelineInput { - s.ContentConfig = v - return s -} - -// SetId sets the Id field's value. -func (s *UpdatePipelineInput) SetId(v string) *UpdatePipelineInput { - s.Id = &v - return s -} - -// SetInputBucket sets the InputBucket field's value. -func (s *UpdatePipelineInput) SetInputBucket(v string) *UpdatePipelineInput { - s.InputBucket = &v - return s -} - -// SetName sets the Name field's value. -func (s *UpdatePipelineInput) SetName(v string) *UpdatePipelineInput { - s.Name = &v - return s -} - -// SetNotifications sets the Notifications field's value. -func (s *UpdatePipelineInput) SetNotifications(v *Notifications) *UpdatePipelineInput { - s.Notifications = v - return s -} - -// SetRole sets the Role field's value. -func (s *UpdatePipelineInput) SetRole(v string) *UpdatePipelineInput { - s.Role = &v - return s -} - -// SetThumbnailConfig sets the ThumbnailConfig field's value. -func (s *UpdatePipelineInput) SetThumbnailConfig(v *PipelineOutputConfig) *UpdatePipelineInput { - s.ThumbnailConfig = v - return s -} - -// The UpdatePipelineNotificationsRequest structure. -type UpdatePipelineNotificationsInput struct { - _ struct{} `type:"structure"` - - // The identifier of the pipeline for which you want to change notification - // settings. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` - - // The topic ARN for the Amazon Simple Notification Service (Amazon SNS) topic - // that you want to notify to report job status. - // - // To receive notifications, you must also subscribe to the new topic in the - // Amazon SNS console. - // - // * Progressing: The topic ARN for the Amazon Simple Notification Service - // (Amazon SNS) topic that you want to notify when Elastic Transcoder has - // started to process jobs that are added to this pipeline. This is the ARN - // that Amazon SNS returned when you created the topic. - // - // * Completed: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder has finished processing a job. This is the ARN - // that Amazon SNS returned when you created the topic. - // - // * Warning: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder encounters a warning condition. This is the ARN - // that Amazon SNS returned when you created the topic. - // - // * Error: The topic ARN for the Amazon SNS topic that you want to notify - // when Elastic Transcoder encounters an error condition. This is the ARN - // that Amazon SNS returned when you created the topic. - // - // Notifications is a required field - Notifications *Notifications `type:"structure" required:"true"` -} - -// String returns the string representation -func (s UpdatePipelineNotificationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UpdatePipelineNotificationsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdatePipelineNotificationsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdatePipelineNotificationsInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.Notifications == nil { - invalidParams.Add(request.NewErrParamRequired("Notifications")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *UpdatePipelineNotificationsInput) SetId(v string) *UpdatePipelineNotificationsInput { - s.Id = &v - return s -} - -// SetNotifications sets the Notifications field's value. -func (s *UpdatePipelineNotificationsInput) SetNotifications(v *Notifications) *UpdatePipelineNotificationsInput { - s.Notifications = v - return s -} - -// The UpdatePipelineNotificationsResponse structure. -type UpdatePipelineNotificationsOutput struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the pipeline - // associated with this notification. - Pipeline *Pipeline `type:"structure"` -} - -// String returns the string representation -func (s UpdatePipelineNotificationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UpdatePipelineNotificationsOutput) GoString() string { - return s.String() -} - -// SetPipeline sets the Pipeline field's value. -func (s *UpdatePipelineNotificationsOutput) SetPipeline(v *Pipeline) *UpdatePipelineNotificationsOutput { - s.Pipeline = v - return s -} - -// When you update a pipeline, Elastic Transcoder returns the values that you -// specified in the request. -type UpdatePipelineOutput struct { - _ struct{} `type:"structure"` - - // The pipeline updated by this UpdatePipelineResponse call. - Pipeline *Pipeline `type:"structure"` - - // Elastic Transcoder returns a warning if the resources used by your pipeline - // are not in the same region as the pipeline. - // - // Using resources in the same region, such as your Amazon S3 buckets, Amazon - // SNS notification topics, and AWS KMS key, reduces processing time and prevents - // cross-regional charges. - Warnings []*Warning `type:"list"` -} - -// String returns the string representation -func (s UpdatePipelineOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UpdatePipelineOutput) GoString() string { - return s.String() -} - -// SetPipeline sets the Pipeline field's value. -func (s *UpdatePipelineOutput) SetPipeline(v *Pipeline) *UpdatePipelineOutput { - s.Pipeline = v - return s -} - -// SetWarnings sets the Warnings field's value. -func (s *UpdatePipelineOutput) SetWarnings(v []*Warning) *UpdatePipelineOutput { - s.Warnings = v - return s -} - -// The UpdatePipelineStatusRequest structure. -type UpdatePipelineStatusInput struct { - _ struct{} `type:"structure"` - - // The identifier of the pipeline to update. - // - // Id is a required field - Id *string `location:"uri" locationName:"Id" type:"string" required:"true"` - - // The desired status of the pipeline: - // - // * Active: The pipeline is processing jobs. - // - // * Paused: The pipeline is not currently processing jobs. - // - // Status is a required field - Status *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s UpdatePipelineStatusInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UpdatePipelineStatusInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdatePipelineStatusInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdatePipelineStatusInput"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetId sets the Id field's value. -func (s *UpdatePipelineStatusInput) SetId(v string) *UpdatePipelineStatusInput { - s.Id = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *UpdatePipelineStatusInput) SetStatus(v string) *UpdatePipelineStatusInput { - s.Status = &v - return s -} - -// When you update status for a pipeline, Elastic Transcoder returns the values -// that you specified in the request. -type UpdatePipelineStatusOutput struct { - _ struct{} `type:"structure"` - - // A section of the response body that provides information about the pipeline. - Pipeline *Pipeline `type:"structure"` -} - -// String returns the string representation -func (s UpdatePipelineStatusOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UpdatePipelineStatusOutput) GoString() string { - return s.String() -} - -// SetPipeline sets the Pipeline field's value. -func (s *UpdatePipelineStatusOutput) SetPipeline(v *Pipeline) *UpdatePipelineStatusOutput { - s.Pipeline = v - return s -} - -// The VideoParameters structure. -type VideoParameters struct { - _ struct{} `type:"structure"` - - // To better control resolution and aspect ratio of output videos, we recommend - // that you use the values MaxWidth, MaxHeight, SizingPolicy, PaddingPolicy, - // and DisplayAspectRatio instead of Resolution and AspectRatio. The two groups - // of settings are mutually exclusive. Do not use them together. - // - // The display aspect ratio of the video in the output file. Valid values include: - // - // auto, 1:1, 4:3, 3:2, 16:9 - // - // If you specify auto, Elastic Transcoder tries to preserve the aspect ratio - // of the input file. - // - // If you specify an aspect ratio for the output file that differs from aspect - // ratio of the input file, Elastic Transcoder adds pillarboxing (black bars - // on the sides) or letterboxing (black bars on the top and bottom) to maintain - // the aspect ratio of the active region of the video. - AspectRatio *string `type:"string"` - - // The bit rate of the video stream in the output file, in kilobits/second. - // Valid values depend on the values of Level and Profile. If you specify auto, - // Elastic Transcoder uses the detected bit rate of the input source. If you - // specify a value other than auto, we recommend that you specify a value less - // than or equal to the maximum H.264-compliant value listed for your level - // and profile: - // - // Level - Maximum video bit rate in kilobits/second (baseline and main Profile) - // : maximum video bit rate in kilobits/second (high Profile) - // - // * 1 - 64 : 80 - // - // * 1b - 128 : 160 - // - // * 1.1 - 192 : 240 - // - // * 1.2 - 384 : 480 - // - // * 1.3 - 768 : 960 - // - // * 2 - 2000 : 2500 - // - // * 3 - 10000 : 12500 - // - // * 3.1 - 14000 : 17500 - // - // * 3.2 - 20000 : 25000 - // - // * 4 - 20000 : 25000 - // - // * 4.1 - 50000 : 62500 - BitRate *string `type:"string"` - - // The video codec for the output file. Valid values include gif, H.264, mpeg2, - // vp8, and vp9. You can only specify vp8 and vp9 when the container type is - // webm, gif when the container type is gif, and mpeg2 when the container type - // is mpg. - Codec *string `type:"string"` - - // Profile (H.264/VP8/VP9 Only) - // - // The H.264 profile that you want to use for the output file. Elastic Transcoder - // supports the following profiles: - // - // * baseline: The profile most commonly used for videoconferencing and for - // mobile applications. - // - // * main: The profile used for standard-definition digital TV broadcasts. - // - // * high: The profile used for high-definition digital TV broadcasts and - // for Blu-ray discs. - // - // Level (H.264 Only) - // - // The H.264 level that you want to use for the output file. Elastic Transcoder - // supports the following levels: - // - // 1, 1b, 1.1, 1.2, 1.3, 2, 2.1, 2.2, 3, 3.1, 3.2, 4, 4.1 - // - // MaxReferenceFrames (H.264 Only) - // - // Applicable only when the value of Video:Codec is H.264. The maximum number - // of previously decoded frames to use as a reference for decoding future frames. - // Valid values are integers 0 through 16, but we recommend that you not use - // a value greater than the following: - // - // Min(Floor(Maximum decoded picture buffer in macroblocks * 256 / (Width in - // pixels * Height in pixels)), 16) - // - // where Width in pixels and Height in pixels represent either MaxWidth and - // MaxHeight, or Resolution. Maximum decoded picture buffer in macroblocks depends - // on the value of the Level object. See the list below. (A macroblock is a - // block of pixels measuring 16x16.) - // - // * 1 - 396 - // - // * 1b - 396 - // - // * 1.1 - 900 - // - // * 1.2 - 2376 - // - // * 1.3 - 2376 - // - // * 2 - 2376 - // - // * 2.1 - 4752 - // - // * 2.2 - 8100 - // - // * 3 - 8100 - // - // * 3.1 - 18000 - // - // * 3.2 - 20480 - // - // * 4 - 32768 - // - // * 4.1 - 32768 - // - // MaxBitRate (Optional, H.264/MPEG2/VP8/VP9 only) - // - // The maximum number of bits per second in a video buffer; the size of the - // buffer is specified by BufferSize. Specify a value between 16 and 62,500. - // You can reduce the bandwidth required to stream a video by reducing the maximum - // bit rate, but this also reduces the quality of the video. - // - // BufferSize (Optional, H.264/MPEG2/VP8/VP9 only) - // - // The maximum number of bits in any x seconds of the output video. This window - // is commonly 10 seconds, the standard segment duration when you're using FMP4 - // or MPEG-TS for the container type of the output video. Specify an integer - // greater than 0. If you specify MaxBitRate and omit BufferSize, Elastic Transcoder - // sets BufferSize to 10 times the value of MaxBitRate. - // - // InterlacedMode (Optional, H.264/MPEG2 Only) - // - // The interlace mode for the output video. - // - // Interlaced video is used to double the perceived frame rate for a video by - // interlacing two fields (one field on every other line, the other field on - // the other lines) so that the human eye registers multiple pictures per frame. - // Interlacing reduces the bandwidth required for transmitting a video, but - // can result in blurred images and flickering. - // - // Valid values include Progressive (no interlacing, top to bottom), TopFirst - // (top field first), BottomFirst (bottom field first), and Auto. - // - // If InterlaceMode is not specified, Elastic Transcoder uses Progressive for - // the output. If Auto is specified, Elastic Transcoder interlaces the output. - // - // ColorSpaceConversionMode (Optional, H.264/MPEG2 Only) - // - // The color space conversion Elastic Transcoder applies to the output video. - // Color spaces are the algorithms used by the computer to store information - // about how to render color. Bt.601 is the standard for standard definition - // video, while Bt.709 is the standard for high definition video. - // - // Valid values include None, Bt709toBt601, Bt601toBt709, and Auto. - // - // If you chose Auto for ColorSpaceConversionMode and your output is interlaced, - // your frame rate is one of 23.97, 24, 25, 29.97, 50, or 60, your SegmentDuration - // is null, and you are using one of the resolution changes from the list below, - // Elastic Transcoder applies the following color space conversions: - // - // * Standard to HD, 720x480 to 1920x1080 - Elastic Transcoder applies Bt601ToBt709 - // - // * Standard to HD, 720x576 to 1920x1080 - Elastic Transcoder applies Bt601ToBt709 - // - // * HD to Standard, 1920x1080 to 720x480 - Elastic Transcoder applies Bt709ToBt601 - // - // * HD to Standard, 1920x1080 to 720x576 - Elastic Transcoder applies Bt709ToBt601 - // - // Elastic Transcoder may change the behavior of the ColorspaceConversionModeAuto - // mode in the future. All outputs in a playlist must use the same ColorSpaceConversionMode. - // - // If you do not specify a ColorSpaceConversionMode, Elastic Transcoder does - // not change the color space of a file. If you are unsure what ColorSpaceConversionMode - // was applied to your output file, you can check the AppliedColorSpaceConversion - // parameter included in your job response. If your job does not have an AppliedColorSpaceConversion - // in its response, no ColorSpaceConversionMode was applied. - // - // ChromaSubsampling - // - // The sampling pattern for the chroma (color) channels of the output video. - // Valid values include yuv420p and yuv422p. - // - // yuv420p samples the chroma information of every other horizontal and every - // other vertical line, yuv422p samples the color information of every horizontal - // line and every other vertical line. - // - // LoopCount (Gif Only) - // - // The number of times you want the output gif to loop. Valid values include - // Infinite and integers between 0 and 100, inclusive. - CodecOptions map[string]*string `type:"map"` - - // The value that Elastic Transcoder adds to the metadata in the output file. - DisplayAspectRatio *string `type:"string"` - - // Applicable only when the value of Video:Codec is one of H.264, MPEG2, or - // VP8. - // - // Whether to use a fixed value for FixedGOP. Valid values are true and false: - // - // * true: Elastic Transcoder uses the value of KeyframesMaxDist for the - // distance between key frames (the number of frames in a group of pictures, - // or GOP). - // - // * false: The distance between key frames can vary. - // - // FixedGOP must be set to true for fmp4 containers. - FixedGOP *string `type:"string"` - - // The frames per second for the video stream in the output file. Valid values - // include: - // - // auto, 10, 15, 23.97, 24, 25, 29.97, 30, 60 - // - // If you specify auto, Elastic Transcoder uses the detected frame rate of the - // input source. If you specify a frame rate, we recommend that you perform - // the following calculation: - // - // Frame rate = maximum recommended decoding speed in luma samples/second / - // (width in pixels * height in pixels) - // - // where: - // - // * width in pixels and height in pixels represent the Resolution of the - // output video. - // - // * maximum recommended decoding speed in Luma samples/second is less than - // or equal to the maximum value listed in the following table, based on - // the value that you specified for Level. - // - // The maximum recommended decoding speed in Luma samples/second for each level - // is described in the following list (Level - Decoding speed): - // - // * 1 - 380160 - // - // * 1b - 380160 - // - // * 1.1 - 76800 - // - // * 1.2 - 1536000 - // - // * 1.3 - 3041280 - // - // * 2 - 3041280 - // - // * 2.1 - 5068800 - // - // * 2.2 - 5184000 - // - // * 3 - 10368000 - // - // * 3.1 - 27648000 - // - // * 3.2 - 55296000 - // - // * 4 - 62914560 - // - // * 4.1 - 62914560 - FrameRate *string `type:"string"` - - // Applicable only when the value of Video:Codec is one of H.264, MPEG2, or - // VP8. - // - // The maximum number of frames between key frames. Key frames are fully encoded - // frames; the frames between key frames are encoded based, in part, on the - // content of the key frames. The value is an integer formatted as a string; - // valid values are between 1 (every frame is a key frame) and 100000, inclusive. - // A higher value results in higher compression but may also discernibly decrease - // video quality. - // - // For Smooth outputs, the FrameRate must have a constant ratio to the KeyframesMaxDist. - // This allows Smooth playlists to switch between different quality levels while - // the file is being played. - // - // For example, an input file can have a FrameRate of 30 with a KeyframesMaxDist - // of 90. The output file then needs to have a ratio of 1:3. Valid outputs would - // have FrameRate of 30, 25, and 10, and KeyframesMaxDist of 90, 75, and 30, - // respectively. - // - // Alternately, this can be achieved by setting FrameRate to auto and having - // the same values for MaxFrameRate and KeyframesMaxDist. - KeyframesMaxDist *string `type:"string"` - - // If you specify auto for FrameRate, Elastic Transcoder uses the frame rate - // of the input video for the frame rate of the output video. Specify the maximum - // frame rate that you want Elastic Transcoder to use when the frame rate of - // the input video is greater than the desired maximum frame rate of the output - // video. Valid values include: 10, 15, 23.97, 24, 25, 29.97, 30, 60. - MaxFrameRate *string `type:"string"` - - // The maximum height of the output video in pixels. If you specify auto, Elastic - // Transcoder uses 1080 (Full HD) as the default value. If you specify a numeric - // value, enter an even integer between 96 and 3072. - MaxHeight *string `type:"string"` - - // The maximum width of the output video in pixels. If you specify auto, Elastic - // Transcoder uses 1920 (Full HD) as the default value. If you specify a numeric - // value, enter an even integer between 128 and 4096. - MaxWidth *string `type:"string"` - - // When you set PaddingPolicy to Pad, Elastic Transcoder may add black bars - // to the top and bottom and/or left and right sides of the output video to - // make the total size of the output video match the values that you specified - // for MaxWidth and MaxHeight. - PaddingPolicy *string `type:"string"` - - // To better control resolution and aspect ratio of output videos, we recommend - // that you use the values MaxWidth, MaxHeight, SizingPolicy, PaddingPolicy, - // and DisplayAspectRatio instead of Resolution and AspectRatio. The two groups - // of settings are mutually exclusive. Do not use them together. - // - // The width and height of the video in the output file, in pixels. Valid values - // are auto and width x height: - // - // * auto: Elastic Transcoder attempts to preserve the width and height of - // the input file, subject to the following rules. - // - // * width x height: The width and height of the output video in pixels. - // - // Note the following about specifying the width and height: - // - // * The width must be an even integer between 128 and 4096, inclusive. - // - // * The height must be an even integer between 96 and 3072, inclusive. - // - // * If you specify a resolution that is less than the resolution of the - // input file, Elastic Transcoder rescales the output file to the lower resolution. - // - // * If you specify a resolution that is greater than the resolution of the - // input file, Elastic Transcoder rescales the output to the higher resolution. - // - // * We recommend that you specify a resolution for which the product of - // width and height is less than or equal to the applicable value in the - // following list (List - Max width x height value): - // - // 1 - 25344 - // - // 1b - 25344 - // - // 1.1 - 101376 - // - // 1.2 - 101376 - // - // 1.3 - 101376 - // - // 2 - 101376 - // - // 2.1 - 202752 - // - // 2.2 - 404720 - // - // 3 - 404720 - // - // 3.1 - 921600 - // - // 3.2 - 1310720 - // - // 4 - 2097152 - // - // 4.1 - 2097152 - Resolution *string `type:"string"` - - // Specify one of the following values to control scaling of the output video: - // - // * Fit: Elastic Transcoder scales the output video so it matches the value - // that you specified in either MaxWidth or MaxHeight without exceeding the - // other value. - // - // * Fill: Elastic Transcoder scales the output video so it matches the value - // that you specified in either MaxWidth or MaxHeight and matches or exceeds - // the other value. Elastic Transcoder centers the output video and then - // crops it in the dimension (if any) that exceeds the maximum value. - // - // * Stretch: Elastic Transcoder stretches the output video to match the - // values that you specified for MaxWidth and MaxHeight. If the relative - // proportions of the input video and the output video are different, the - // output video will be distorted. - // - // * Keep: Elastic Transcoder does not scale the output video. If either - // dimension of the input video exceeds the values that you specified for - // MaxWidth and MaxHeight, Elastic Transcoder crops the output video. - // - // * ShrinkToFit: Elastic Transcoder scales the output video down so that - // its dimensions match the values that you specified for at least one of - // MaxWidth and MaxHeight without exceeding either value. If you specify - // this option, Elastic Transcoder does not scale the video up. - // - // * ShrinkToFill: Elastic Transcoder scales the output video down so that - // its dimensions match the values that you specified for at least one of - // MaxWidth and MaxHeight without dropping below either value. If you specify - // this option, Elastic Transcoder does not scale the video up. - SizingPolicy *string `type:"string"` - - // Settings for the size, location, and opacity of graphics that you want Elastic - // Transcoder to overlay over videos that are transcoded using this preset. - // You can specify settings for up to four watermarks. Watermarks appear in - // the specified size and location, and with the specified opacity for the duration - // of the transcoded video. - // - // Watermarks can be in .png or .jpg format. If you want to display a watermark - // that is not rectangular, use the .png format, which supports transparency. - // - // When you create a job that uses this preset, you specify the .png or .jpg - // graphics that you want Elastic Transcoder to include in the transcoded videos. - // You can specify fewer graphics in the job than you specify watermark settings - // in the preset, which allows you to use the same preset for up to four watermarks - // that have different dimensions. - Watermarks []*PresetWatermark `type:"list"` -} - -// String returns the string representation -func (s VideoParameters) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VideoParameters) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *VideoParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "VideoParameters"} - if s.Watermarks != nil { - for i, v := range s.Watermarks { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Watermarks", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAspectRatio sets the AspectRatio field's value. -func (s *VideoParameters) SetAspectRatio(v string) *VideoParameters { - s.AspectRatio = &v - return s -} - -// SetBitRate sets the BitRate field's value. -func (s *VideoParameters) SetBitRate(v string) *VideoParameters { - s.BitRate = &v - return s -} - -// SetCodec sets the Codec field's value. -func (s *VideoParameters) SetCodec(v string) *VideoParameters { - s.Codec = &v - return s -} - -// SetCodecOptions sets the CodecOptions field's value. -func (s *VideoParameters) SetCodecOptions(v map[string]*string) *VideoParameters { - s.CodecOptions = v - return s -} - -// SetDisplayAspectRatio sets the DisplayAspectRatio field's value. -func (s *VideoParameters) SetDisplayAspectRatio(v string) *VideoParameters { - s.DisplayAspectRatio = &v - return s -} - -// SetFixedGOP sets the FixedGOP field's value. -func (s *VideoParameters) SetFixedGOP(v string) *VideoParameters { - s.FixedGOP = &v - return s -} - -// SetFrameRate sets the FrameRate field's value. -func (s *VideoParameters) SetFrameRate(v string) *VideoParameters { - s.FrameRate = &v - return s -} - -// SetKeyframesMaxDist sets the KeyframesMaxDist field's value. -func (s *VideoParameters) SetKeyframesMaxDist(v string) *VideoParameters { - s.KeyframesMaxDist = &v - return s -} - -// SetMaxFrameRate sets the MaxFrameRate field's value. -func (s *VideoParameters) SetMaxFrameRate(v string) *VideoParameters { - s.MaxFrameRate = &v - return s -} - -// SetMaxHeight sets the MaxHeight field's value. -func (s *VideoParameters) SetMaxHeight(v string) *VideoParameters { - s.MaxHeight = &v - return s -} - -// SetMaxWidth sets the MaxWidth field's value. -func (s *VideoParameters) SetMaxWidth(v string) *VideoParameters { - s.MaxWidth = &v - return s -} - -// SetPaddingPolicy sets the PaddingPolicy field's value. -func (s *VideoParameters) SetPaddingPolicy(v string) *VideoParameters { - s.PaddingPolicy = &v - return s -} - -// SetResolution sets the Resolution field's value. -func (s *VideoParameters) SetResolution(v string) *VideoParameters { - s.Resolution = &v - return s -} - -// SetSizingPolicy sets the SizingPolicy field's value. -func (s *VideoParameters) SetSizingPolicy(v string) *VideoParameters { - s.SizingPolicy = &v - return s -} - -// SetWatermarks sets the Watermarks field's value. -func (s *VideoParameters) SetWatermarks(v []*PresetWatermark) *VideoParameters { - s.Watermarks = v - return s -} - -// Elastic Transcoder returns a warning if the resources used by your pipeline -// are not in the same region as the pipeline. -// -// Using resources in the same region, such as your Amazon S3 buckets, Amazon -// SNS notification topics, and AWS KMS key, reduces processing time and prevents -// cross-regional charges. -type Warning struct { - _ struct{} `type:"structure"` - - // The code of the cross-regional warning. - Code *string `type:"string"` - - // The message explaining what resources are in a different region from the - // pipeline. - // - // AWS KMS keys must be in the same region as the pipeline. - Message *string `type:"string"` -} - -// String returns the string representation -func (s Warning) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Warning) GoString() string { - return s.String() -} - -// SetCode sets the Code field's value. -func (s *Warning) SetCode(v string) *Warning { - s.Code = &v - return s -} - -// SetMessage sets the Message field's value. -func (s *Warning) SetMessage(v string) *Warning { - s.Message = &v - return s -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/doc.go b/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/doc.go deleted file mode 100644 index 20e8ff50..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package elastictranscoder provides the client and types for making API -// requests to Amazon Elastic Transcoder. -// -// The AWS Elastic Transcoder Service. -// -// See elastictranscoder package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/elastictranscoder/ -// -// Using the Client -// -// To Amazon Elastic Transcoder with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the Amazon Elastic Transcoder client ElasticTranscoder for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/elastictranscoder/#New -package elastictranscoder diff --git a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/elastictranscoderiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/elastictranscoderiface/interface.go deleted file mode 100644 index 81d11814..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/elastictranscoderiface/interface.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package elastictranscoderiface provides an interface to enable mocking the Amazon Elastic Transcoder service client -// for testing your code. -// -// It is important to note that this interface will have breaking changes -// when the service model is updated and adds new API operations, paginators, -// and waiters. -package elastictranscoderiface - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/elastictranscoder" -) - -// ElasticTranscoderAPI provides an interface to enable mocking the -// elastictranscoder.ElasticTranscoder service client's API operation, -// paginators, and waiters. This make unit testing your code that calls out -// to the SDK's service client's calls easier. -// -// The best way to use this interface is so the SDK's service client's calls -// can be stubbed out for unit testing your code with the SDK without needing -// to inject custom request handlers into the SDK's request pipeline. -// -// // myFunc uses an SDK service client to make a request to -// // Amazon Elastic Transcoder. -// func myFunc(svc elastictranscoderiface.ElasticTranscoderAPI) bool { -// // Make svc.CancelJob request -// } -// -// func main() { -// sess := session.New() -// svc := elastictranscoder.New(sess) -// -// myFunc(svc) -// } -// -// In your _test.go file: -// -// // Define a mock struct to be used in your unit tests of myFunc. -// type mockElasticTranscoderClient struct { -// elastictranscoderiface.ElasticTranscoderAPI -// } -// func (m *mockElasticTranscoderClient) CancelJob(input *elastictranscoder.CancelJobInput) (*elastictranscoder.CancelJobOutput, error) { -// // mock response/functionality -// } -// -// func TestMyFunc(t *testing.T) { -// // Setup Test -// mockSvc := &mockElasticTranscoderClient{} -// -// myfunc(mockSvc) -// -// // Verify myFunc's functionality -// } -// -// It is important to note that this interface will have breaking changes -// when the service model is updated and adds new API operations, paginators, -// and waiters. Its suggested to use the pattern above for testing, or using -// tooling to generate mocks to satisfy the interfaces. -type ElasticTranscoderAPI interface { - CancelJob(*elastictranscoder.CancelJobInput) (*elastictranscoder.CancelJobOutput, error) - CancelJobWithContext(aws.Context, *elastictranscoder.CancelJobInput, ...request.Option) (*elastictranscoder.CancelJobOutput, error) - CancelJobRequest(*elastictranscoder.CancelJobInput) (*request.Request, *elastictranscoder.CancelJobOutput) - - CreateJob(*elastictranscoder.CreateJobInput) (*elastictranscoder.CreateJobResponse, error) - CreateJobWithContext(aws.Context, *elastictranscoder.CreateJobInput, ...request.Option) (*elastictranscoder.CreateJobResponse, error) - CreateJobRequest(*elastictranscoder.CreateJobInput) (*request.Request, *elastictranscoder.CreateJobResponse) - - CreatePipeline(*elastictranscoder.CreatePipelineInput) (*elastictranscoder.CreatePipelineOutput, error) - CreatePipelineWithContext(aws.Context, *elastictranscoder.CreatePipelineInput, ...request.Option) (*elastictranscoder.CreatePipelineOutput, error) - CreatePipelineRequest(*elastictranscoder.CreatePipelineInput) (*request.Request, *elastictranscoder.CreatePipelineOutput) - - CreatePreset(*elastictranscoder.CreatePresetInput) (*elastictranscoder.CreatePresetOutput, error) - CreatePresetWithContext(aws.Context, *elastictranscoder.CreatePresetInput, ...request.Option) (*elastictranscoder.CreatePresetOutput, error) - CreatePresetRequest(*elastictranscoder.CreatePresetInput) (*request.Request, *elastictranscoder.CreatePresetOutput) - - DeletePipeline(*elastictranscoder.DeletePipelineInput) (*elastictranscoder.DeletePipelineOutput, error) - DeletePipelineWithContext(aws.Context, *elastictranscoder.DeletePipelineInput, ...request.Option) (*elastictranscoder.DeletePipelineOutput, error) - DeletePipelineRequest(*elastictranscoder.DeletePipelineInput) (*request.Request, *elastictranscoder.DeletePipelineOutput) - - DeletePreset(*elastictranscoder.DeletePresetInput) (*elastictranscoder.DeletePresetOutput, error) - DeletePresetWithContext(aws.Context, *elastictranscoder.DeletePresetInput, ...request.Option) (*elastictranscoder.DeletePresetOutput, error) - DeletePresetRequest(*elastictranscoder.DeletePresetInput) (*request.Request, *elastictranscoder.DeletePresetOutput) - - ListJobsByPipeline(*elastictranscoder.ListJobsByPipelineInput) (*elastictranscoder.ListJobsByPipelineOutput, error) - ListJobsByPipelineWithContext(aws.Context, *elastictranscoder.ListJobsByPipelineInput, ...request.Option) (*elastictranscoder.ListJobsByPipelineOutput, error) - ListJobsByPipelineRequest(*elastictranscoder.ListJobsByPipelineInput) (*request.Request, *elastictranscoder.ListJobsByPipelineOutput) - - ListJobsByPipelinePages(*elastictranscoder.ListJobsByPipelineInput, func(*elastictranscoder.ListJobsByPipelineOutput, bool) bool) error - ListJobsByPipelinePagesWithContext(aws.Context, *elastictranscoder.ListJobsByPipelineInput, func(*elastictranscoder.ListJobsByPipelineOutput, bool) bool, ...request.Option) error - - ListJobsByStatus(*elastictranscoder.ListJobsByStatusInput) (*elastictranscoder.ListJobsByStatusOutput, error) - ListJobsByStatusWithContext(aws.Context, *elastictranscoder.ListJobsByStatusInput, ...request.Option) (*elastictranscoder.ListJobsByStatusOutput, error) - ListJobsByStatusRequest(*elastictranscoder.ListJobsByStatusInput) (*request.Request, *elastictranscoder.ListJobsByStatusOutput) - - ListJobsByStatusPages(*elastictranscoder.ListJobsByStatusInput, func(*elastictranscoder.ListJobsByStatusOutput, bool) bool) error - ListJobsByStatusPagesWithContext(aws.Context, *elastictranscoder.ListJobsByStatusInput, func(*elastictranscoder.ListJobsByStatusOutput, bool) bool, ...request.Option) error - - ListPipelines(*elastictranscoder.ListPipelinesInput) (*elastictranscoder.ListPipelinesOutput, error) - ListPipelinesWithContext(aws.Context, *elastictranscoder.ListPipelinesInput, ...request.Option) (*elastictranscoder.ListPipelinesOutput, error) - ListPipelinesRequest(*elastictranscoder.ListPipelinesInput) (*request.Request, *elastictranscoder.ListPipelinesOutput) - - ListPipelinesPages(*elastictranscoder.ListPipelinesInput, func(*elastictranscoder.ListPipelinesOutput, bool) bool) error - ListPipelinesPagesWithContext(aws.Context, *elastictranscoder.ListPipelinesInput, func(*elastictranscoder.ListPipelinesOutput, bool) bool, ...request.Option) error - - ListPresets(*elastictranscoder.ListPresetsInput) (*elastictranscoder.ListPresetsOutput, error) - ListPresetsWithContext(aws.Context, *elastictranscoder.ListPresetsInput, ...request.Option) (*elastictranscoder.ListPresetsOutput, error) - ListPresetsRequest(*elastictranscoder.ListPresetsInput) (*request.Request, *elastictranscoder.ListPresetsOutput) - - ListPresetsPages(*elastictranscoder.ListPresetsInput, func(*elastictranscoder.ListPresetsOutput, bool) bool) error - ListPresetsPagesWithContext(aws.Context, *elastictranscoder.ListPresetsInput, func(*elastictranscoder.ListPresetsOutput, bool) bool, ...request.Option) error - - ReadJob(*elastictranscoder.ReadJobInput) (*elastictranscoder.ReadJobOutput, error) - ReadJobWithContext(aws.Context, *elastictranscoder.ReadJobInput, ...request.Option) (*elastictranscoder.ReadJobOutput, error) - ReadJobRequest(*elastictranscoder.ReadJobInput) (*request.Request, *elastictranscoder.ReadJobOutput) - - ReadPipeline(*elastictranscoder.ReadPipelineInput) (*elastictranscoder.ReadPipelineOutput, error) - ReadPipelineWithContext(aws.Context, *elastictranscoder.ReadPipelineInput, ...request.Option) (*elastictranscoder.ReadPipelineOutput, error) - ReadPipelineRequest(*elastictranscoder.ReadPipelineInput) (*request.Request, *elastictranscoder.ReadPipelineOutput) - - ReadPreset(*elastictranscoder.ReadPresetInput) (*elastictranscoder.ReadPresetOutput, error) - ReadPresetWithContext(aws.Context, *elastictranscoder.ReadPresetInput, ...request.Option) (*elastictranscoder.ReadPresetOutput, error) - ReadPresetRequest(*elastictranscoder.ReadPresetInput) (*request.Request, *elastictranscoder.ReadPresetOutput) - - TestRole(*elastictranscoder.TestRoleInput) (*elastictranscoder.TestRoleOutput, error) - TestRoleWithContext(aws.Context, *elastictranscoder.TestRoleInput, ...request.Option) (*elastictranscoder.TestRoleOutput, error) - TestRoleRequest(*elastictranscoder.TestRoleInput) (*request.Request, *elastictranscoder.TestRoleOutput) - - UpdatePipeline(*elastictranscoder.UpdatePipelineInput) (*elastictranscoder.UpdatePipelineOutput, error) - UpdatePipelineWithContext(aws.Context, *elastictranscoder.UpdatePipelineInput, ...request.Option) (*elastictranscoder.UpdatePipelineOutput, error) - UpdatePipelineRequest(*elastictranscoder.UpdatePipelineInput) (*request.Request, *elastictranscoder.UpdatePipelineOutput) - - UpdatePipelineNotifications(*elastictranscoder.UpdatePipelineNotificationsInput) (*elastictranscoder.UpdatePipelineNotificationsOutput, error) - UpdatePipelineNotificationsWithContext(aws.Context, *elastictranscoder.UpdatePipelineNotificationsInput, ...request.Option) (*elastictranscoder.UpdatePipelineNotificationsOutput, error) - UpdatePipelineNotificationsRequest(*elastictranscoder.UpdatePipelineNotificationsInput) (*request.Request, *elastictranscoder.UpdatePipelineNotificationsOutput) - - UpdatePipelineStatus(*elastictranscoder.UpdatePipelineStatusInput) (*elastictranscoder.UpdatePipelineStatusOutput, error) - UpdatePipelineStatusWithContext(aws.Context, *elastictranscoder.UpdatePipelineStatusInput, ...request.Option) (*elastictranscoder.UpdatePipelineStatusOutput, error) - UpdatePipelineStatusRequest(*elastictranscoder.UpdatePipelineStatusInput) (*request.Request, *elastictranscoder.UpdatePipelineStatusOutput) - - WaitUntilJobComplete(*elastictranscoder.ReadJobInput) error - WaitUntilJobCompleteWithContext(aws.Context, *elastictranscoder.ReadJobInput, ...request.WaiterOption) error -} - -var _ ElasticTranscoderAPI = (*elastictranscoder.ElasticTranscoder)(nil) diff --git a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/errors.go b/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/errors.go deleted file mode 100644 index 7c670785..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/errors.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elastictranscoder - -const ( - - // ErrCodeAccessDeniedException for service response error code - // "AccessDeniedException". - // - // General authentication failure. The request was not signed correctly. - ErrCodeAccessDeniedException = "AccessDeniedException" - - // ErrCodeIncompatibleVersionException for service response error code - // "IncompatibleVersionException". - ErrCodeIncompatibleVersionException = "IncompatibleVersionException" - - // ErrCodeInternalServiceException for service response error code - // "InternalServiceException". - // - // Elastic Transcoder encountered an unexpected exception while trying to fulfill - // the request. - ErrCodeInternalServiceException = "InternalServiceException" - - // ErrCodeLimitExceededException for service response error code - // "LimitExceededException". - // - // Too many operations for a given AWS account. For example, the number of pipelines - // exceeds the maximum allowed. - ErrCodeLimitExceededException = "LimitExceededException" - - // ErrCodeResourceInUseException for service response error code - // "ResourceInUseException". - // - // The resource you are attempting to change is in use. For example, you are - // attempting to delete a pipeline that is currently in use. - ErrCodeResourceInUseException = "ResourceInUseException" - - // ErrCodeResourceNotFoundException for service response error code - // "ResourceNotFoundException". - // - // The requested resource does not exist or is not available. For example, the - // pipeline to which you're trying to add a job doesn't exist or is still being - // created. - ErrCodeResourceNotFoundException = "ResourceNotFoundException" - - // ErrCodeValidationException for service response error code - // "ValidationException". - // - // One or more required parameter values were not provided in the request. - ErrCodeValidationException = "ValidationException" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/service.go b/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/service.go deleted file mode 100644 index 29d15e2e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/service.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elastictranscoder - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/private/protocol/restjson" -) - -// ElasticTranscoder provides the API operation methods for making requests to -// Amazon Elastic Transcoder. See this package's package overview docs -// for details on the service. -// -// ElasticTranscoder methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type ElasticTranscoder struct { - *client.Client -} - -// Used for custom client initialization logic -var initClient func(*client.Client) - -// Used for custom request initialization logic -var initRequest func(*request.Request) - -// Service information constants -const ( - ServiceName = "elastictranscoder" // Service endpoint prefix API calls made to. - EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. -) - -// New creates a new instance of the ElasticTranscoder client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a ElasticTranscoder client from just a session. -// svc := elastictranscoder.New(mySession) -// -// // Create a ElasticTranscoder client with additional configuration -// svc := elastictranscoder.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *ElasticTranscoder { - c := p.ClientConfig(EndpointsID, cfgs...) - return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *ElasticTranscoder { - svc := &ElasticTranscoder{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2012-09-25", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a ElasticTranscoder operation and runs any -// custom request initialization. -func (c *ElasticTranscoder) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - // Run custom request initialization if present - if initRequest != nil { - initRequest(req) - } - - return req -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/waiters.go deleted file mode 100644 index a482fa79..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/waiters.go +++ /dev/null @@ -1,66 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elastictranscoder - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// WaitUntilJobComplete uses the Amazon Elastic Transcoder API operation -// ReadJob to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ElasticTranscoder) WaitUntilJobComplete(input *ReadJobInput) error { - return c.WaitUntilJobCompleteWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilJobCompleteWithContext is an extended version of WaitUntilJobComplete. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ElasticTranscoder) WaitUntilJobCompleteWithContext(ctx aws.Context, input *ReadJobInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilJobComplete", - MaxAttempts: 120, - Delay: request.ConstantWaiterDelay(30 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathWaiterMatch, Argument: "Job.Status", - Expected: "Complete", - }, - { - State: request.FailureWaiterState, - Matcher: request.PathWaiterMatch, Argument: "Job.Status", - Expected: "Canceled", - }, - { - State: request.FailureWaiterState, - Matcher: request.PathWaiterMatch, Argument: "Job.Status", - Expected: "Error", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *ReadJobInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ReadJobRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/generate.go b/vendor/github.com/aws/aws-sdk-go/service/generate.go deleted file mode 100644 index 3ffc9fcc..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/generate.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package service contains automatically generated AWS clients. -package service - -//go:generate go run -tags codegen ../private/model/cli/gen-api/main.go -path=../service ../models/apis/*/*/api-2.json -//go:generate gofmt -s -w ../service diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go deleted file mode 100644 index 3b8be437..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ /dev/null @@ -1,2358 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package sts - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" -) - -const opAssumeRole = "AssumeRole" - -// AssumeRoleRequest generates a "aws/request.Request" representing the -// client's request for the AssumeRole operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AssumeRole for more information on using the AssumeRole -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the AssumeRoleRequest method. -// req, resp := client.AssumeRoleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole -func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, output *AssumeRoleOutput) { - op := &request.Operation{ - Name: opAssumeRole, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AssumeRoleInput{} - } - - output = &AssumeRoleOutput{} - req = c.newRequest(op, input, output) - return -} - -// AssumeRole API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials (consisting of an access -// key ID, a secret access key, and a security token) that you can use to access -// AWS resources that you might not normally have access to. Typically, you -// use AssumeRole for cross-account access or federation. For a comparison of -// AssumeRole with the other APIs that produce temporary credentials, see Requesting -// Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// Important: You cannot call AssumeRole by using AWS root account credentials; -// access is denied. You must use credentials for an IAM user or an IAM role -// to call AssumeRole. -// -// For cross-account access, imagine that you own multiple accounts and need -// to access resources in each account. You could create long-term credentials -// in each account to access those resources. However, managing all those credentials -// and remembering which one can access which account can be time consuming. -// Instead, you can create one set of long-term credentials in one account and -// then use temporary security credentials to access all the other accounts -// by assuming roles in those accounts. For more information about roles, see -// IAM Roles (Delegation and Federation) (http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html) -// in the IAM User Guide. -// -// For federation, you can, for example, grant single sign-on access to the -// AWS Management Console. If you already have an identity and authentication -// system in your corporate network, you don't have to recreate user identities -// in AWS in order to grant those user identities access to AWS. Instead, after -// a user has been authenticated, you call AssumeRole (and specify the role -// with the appropriate permissions) to get temporary security credentials for -// that user. With those temporary security credentials, you construct a sign-in -// URL that users can use to access the console. For more information, see Common -// Scenarios for Temporary Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html#sts-introduction) -// in the IAM User Guide. -// -// The temporary security credentials are valid for the duration that you specified -// when calling AssumeRole, which can be from 900 seconds (15 minutes) to a -// maximum of 3600 seconds (1 hour). The default is 1 hour. -// -// The temporary security credentials created by AssumeRole can be used to make -// API calls to any AWS service with the following exception: you cannot call -// the STS service's GetFederationToken or GetSessionToken APIs. -// -// Optionally, you can pass an IAM access policy to this operation. If you choose -// not to pass a policy, the temporary security credentials that are returned -// by the operation have the permissions that are defined in the access policy -// of the role that is being assumed. If you pass a policy to this operation, -// the temporary security credentials that are returned by the operation have -// the permissions that are allowed by both the access policy of the role that -// is being assumed, and the policy that you pass. This gives you a way to further -// restrict the permissions for the resulting temporary security credentials. -// You cannot use the passed policy to grant permissions that are in excess -// of those allowed by the access policy of the role that is being assumed. -// For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, -// and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) -// in the IAM User Guide. -// -// To assume a role, your AWS account must be trusted by the role. The trust -// relationship is defined in the role's trust policy when the role is created. -// That trust policy states which accounts are allowed to delegate access to -// this account's role. -// -// The user who wants to access the role must also have permissions delegated -// from the role's administrator. If the user is in a different account than -// the role, then the user's administrator must attach a policy that allows -// the user to call AssumeRole on the ARN of the role in the other account. -// If the user is in the same account as the role, then you can either attach -// a policy to the user (identical to the previous different account user), -// or you can add the user as a principal directly in the role's trust policy -// -// Using MFA with AssumeRole -// -// You can optionally include multi-factor authentication (MFA) information -// when you call AssumeRole. This is useful for cross-account scenarios in which -// you want to make sure that the user who is assuming the role has been authenticated -// using an AWS MFA device. In that scenario, the trust policy of the role being -// assumed includes a condition that tests for MFA authentication; if the caller -// does not include valid MFA information, the request to assume the role is -// denied. The condition in a trust policy that tests for MFA authentication -// might look like the following example. -// -// "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}} -// -// For more information, see Configuring MFA-Protected API Access (http://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html) -// in the IAM User Guide guide. -// -// To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode -// parameters. The SerialNumber value identifies the user's hardware or virtual -// MFA device. The TokenCode is the time-based one-time password (TOTP) that -// the MFA devices produces. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation AssumeRole for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the policy document was too large. The error -// message describes how big the policy document is, in packed form, as a percentage -// of what the API allows. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole -func (c *STS) AssumeRole(input *AssumeRoleInput) (*AssumeRoleOutput, error) { - req, out := c.AssumeRoleRequest(input) - return out, req.Send() -} - -// AssumeRoleWithContext is the same as AssumeRole with the addition of -// the ability to pass a context and additional request options. -// -// See AssumeRole for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) AssumeRoleWithContext(ctx aws.Context, input *AssumeRoleInput, opts ...request.Option) (*AssumeRoleOutput, error) { - req, out := c.AssumeRoleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAssumeRoleWithSAML = "AssumeRoleWithSAML" - -// AssumeRoleWithSAMLRequest generates a "aws/request.Request" representing the -// client's request for the AssumeRoleWithSAML operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AssumeRoleWithSAML for more information on using the AssumeRoleWithSAML -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the AssumeRoleWithSAMLRequest method. -// req, resp := client.AssumeRoleWithSAMLRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML -func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *request.Request, output *AssumeRoleWithSAMLOutput) { - op := &request.Operation{ - Name: opAssumeRoleWithSAML, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AssumeRoleWithSAMLInput{} - } - - output = &AssumeRoleWithSAMLOutput{} - req = c.newRequest(op, input, output) - return -} - -// AssumeRoleWithSAML API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials for users who have been authenticated -// via a SAML authentication response. This operation provides a mechanism for -// tying an enterprise identity store or directory to role-based AWS access -// without user-specific credentials or configuration. For a comparison of AssumeRoleWithSAML -// with the other APIs that produce temporary credentials, see Requesting Temporary -// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// The temporary security credentials returned by this operation consist of -// an access key ID, a secret access key, and a security token. Applications -// can use these temporary security credentials to sign calls to AWS services. -// -// The temporary security credentials are valid for the duration that you specified -// when calling AssumeRole, or until the time specified in the SAML authentication -// response's SessionNotOnOrAfter value, whichever is shorter. The duration -// can be from 900 seconds (15 minutes) to a maximum of 3600 seconds (1 hour). -// The default is 1 hour. -// -// The temporary security credentials created by AssumeRoleWithSAML can be used -// to make API calls to any AWS service with the following exception: you cannot -// call the STS service's GetFederationToken or GetSessionToken APIs. -// -// Optionally, you can pass an IAM access policy to this operation. If you choose -// not to pass a policy, the temporary security credentials that are returned -// by the operation have the permissions that are defined in the access policy -// of the role that is being assumed. If you pass a policy to this operation, -// the temporary security credentials that are returned by the operation have -// the permissions that are allowed by the intersection of both the access policy -// of the role that is being assumed, and the policy that you pass. This means -// that both policies must grant the permission for the action to be allowed. -// This gives you a way to further restrict the permissions for the resulting -// temporary security credentials. You cannot use the passed policy to grant -// permissions that are in excess of those allowed by the access policy of the -// role that is being assumed. For more information, see Permissions for AssumeRole, -// AssumeRoleWithSAML, and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) -// in the IAM User Guide. -// -// Before your application can call AssumeRoleWithSAML, you must configure your -// SAML identity provider (IdP) to issue the claims required by AWS. Additionally, -// you must use AWS Identity and Access Management (IAM) to create a SAML provider -// entity in your AWS account that represents your identity provider, and create -// an IAM role that specifies this SAML provider in its trust policy. -// -// Calling AssumeRoleWithSAML does not require the use of AWS security credentials. -// The identity of the caller is validated by using keys in the metadata document -// that is uploaded for the SAML provider entity for your identity provider. -// -// Calling AssumeRoleWithSAML can result in an entry in your AWS CloudTrail -// logs. The entry includes the value in the NameID element of the SAML assertion. -// We recommend that you use a NameIDType that is not associated with any personally -// identifiable information (PII). For example, you could instead use the Persistent -// Identifier (urn:oasis:names:tc:SAML:2.0:nameid-format:persistent). -// -// For more information, see the following resources: -// -// * About SAML 2.0-based Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) -// in the IAM User Guide. -// -// * Creating SAML Identity Providers (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) -// in the IAM User Guide. -// -// * Configuring a Relying Party and Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) -// in the IAM User Guide. -// -// * Creating a Role for SAML 2.0 Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) -// in the IAM User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation AssumeRoleWithSAML for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the policy document was too large. The error -// message describes how big the policy document is, in packed form, as a percentage -// of what the API allows. -// -// * ErrCodeIDPRejectedClaimException "IDPRejectedClaim" -// The identity provider (IdP) reported that authentication failed. This might -// be because the claim is invalid. -// -// If this error is returned for the AssumeRoleWithWebIdentity operation, it -// can also mean that the claim has expired or has been explicitly revoked. -// -// * ErrCodeInvalidIdentityTokenException "InvalidIdentityToken" -// The web identity token that was passed could not be validated by AWS. Get -// a new identity token from the identity provider and then retry the request. -// -// * ErrCodeExpiredTokenException "ExpiredTokenException" -// The web identity token that was passed is expired or is not valid. Get a -// new identity token from the identity provider and then retry the request. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML -func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWithSAMLOutput, error) { - req, out := c.AssumeRoleWithSAMLRequest(input) - return out, req.Send() -} - -// AssumeRoleWithSAMLWithContext is the same as AssumeRoleWithSAML with the addition of -// the ability to pass a context and additional request options. -// -// See AssumeRoleWithSAML for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) AssumeRoleWithSAMLWithContext(ctx aws.Context, input *AssumeRoleWithSAMLInput, opts ...request.Option) (*AssumeRoleWithSAMLOutput, error) { - req, out := c.AssumeRoleWithSAMLRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity" - -// AssumeRoleWithWebIdentityRequest generates a "aws/request.Request" representing the -// client's request for the AssumeRoleWithWebIdentity operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AssumeRoleWithWebIdentity for more information on using the AssumeRoleWithWebIdentity -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the AssumeRoleWithWebIdentityRequest method. -// req, resp := client.AssumeRoleWithWebIdentityRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity -func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityInput) (req *request.Request, output *AssumeRoleWithWebIdentityOutput) { - op := &request.Operation{ - Name: opAssumeRoleWithWebIdentity, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AssumeRoleWithWebIdentityInput{} - } - - output = &AssumeRoleWithWebIdentityOutput{} - req = c.newRequest(op, input, output) - return -} - -// AssumeRoleWithWebIdentity API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials for users who have been authenticated -// in a mobile or web application with a web identity provider, such as Amazon -// Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible -// identity provider. -// -// For mobile applications, we recommend that you use Amazon Cognito. You can -// use Amazon Cognito with the AWS SDK for iOS (http://aws.amazon.com/sdkforios/) -// and the AWS SDK for Android (http://aws.amazon.com/sdkforandroid/) to uniquely -// identify a user and supply the user with a consistent identity throughout -// the lifetime of an application. -// -// To learn more about Amazon Cognito, see Amazon Cognito Overview (http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840) -// in the AWS SDK for Android Developer Guide guide and Amazon Cognito Overview -// (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664) -// in the AWS SDK for iOS Developer Guide. -// -// Calling AssumeRoleWithWebIdentity does not require the use of AWS security -// credentials. Therefore, you can distribute an application (for example, on -// mobile devices) that requests temporary security credentials without including -// long-term AWS credentials in the application, and without deploying server-based -// proxy services that use long-term AWS credentials. Instead, the identity -// of the caller is validated by using a token from the web identity provider. -// For a comparison of AssumeRoleWithWebIdentity with the other APIs that produce -// temporary credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// The temporary security credentials returned by this API consist of an access -// key ID, a secret access key, and a security token. Applications can use these -// temporary security credentials to sign calls to AWS service APIs. -// -// The credentials are valid for the duration that you specified when calling -// AssumeRoleWithWebIdentity, which can be from 900 seconds (15 minutes) to -// a maximum of 3600 seconds (1 hour). The default is 1 hour. -// -// The temporary security credentials created by AssumeRoleWithWebIdentity can -// be used to make API calls to any AWS service with the following exception: -// you cannot call the STS service's GetFederationToken or GetSessionToken APIs. -// -// Optionally, you can pass an IAM access policy to this operation. If you choose -// not to pass a policy, the temporary security credentials that are returned -// by the operation have the permissions that are defined in the access policy -// of the role that is being assumed. If you pass a policy to this operation, -// the temporary security credentials that are returned by the operation have -// the permissions that are allowed by both the access policy of the role that -// is being assumed, and the policy that you pass. This gives you a way to further -// restrict the permissions for the resulting temporary security credentials. -// You cannot use the passed policy to grant permissions that are in excess -// of those allowed by the access policy of the role that is being assumed. -// For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, -// and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) -// in the IAM User Guide. -// -// Before your application can call AssumeRoleWithWebIdentity, you must have -// an identity token from a supported identity provider and create a role that -// the application can assume. The role that your application assumes must trust -// the identity provider that is associated with the identity token. In other -// words, the identity provider must be specified in the role's trust policy. -// -// Calling AssumeRoleWithWebIdentity can result in an entry in your AWS CloudTrail -// logs. The entry includes the Subject (http://openid.net/specs/openid-connect-core-1_0.html#Claims) -// of the provided Web Identity Token. We recommend that you avoid using any -// personally identifiable information (PII) in this field. For example, you -// could instead use a GUID or a pairwise identifier, as suggested in the OIDC -// specification (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes). -// -// For more information about how to use web identity federation and the AssumeRoleWithWebIdentity -// API, see the following resources: -// -// * Using Web Identity Federation APIs for Mobile Apps (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html) -// and Federation Through a Web-based Identity Provider (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). -// -// -// * Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html). -// This interactive website lets you walk through the process of authenticating -// via Login with Amazon, Facebook, or Google, getting temporary security -// credentials, and then using those credentials to make a request to AWS. -// -// -// * AWS SDK for iOS (http://aws.amazon.com/sdkforios/) and AWS SDK for Android -// (http://aws.amazon.com/sdkforandroid/). These toolkits contain sample -// apps that show how to invoke the identity providers, and then how to use -// the information from these providers to get and use temporary security -// credentials. -// -// * Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/4617974389850313). -// This article discusses web identity federation and shows an example of -// how to use web identity federation to get access to content in Amazon -// S3. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation AssumeRoleWithWebIdentity for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the policy document was too large. The error -// message describes how big the policy document is, in packed form, as a percentage -// of what the API allows. -// -// * ErrCodeIDPRejectedClaimException "IDPRejectedClaim" -// The identity provider (IdP) reported that authentication failed. This might -// be because the claim is invalid. -// -// If this error is returned for the AssumeRoleWithWebIdentity operation, it -// can also mean that the claim has expired or has been explicitly revoked. -// -// * ErrCodeIDPCommunicationErrorException "IDPCommunicationError" -// The request could not be fulfilled because the non-AWS identity provider -// (IDP) that was asked to verify the incoming identity token could not be reached. -// This is often a transient error caused by network conditions. Retry the request -// a limited number of times so that you don't exceed the request rate. If the -// error persists, the non-AWS identity provider might be down or not responding. -// -// * ErrCodeInvalidIdentityTokenException "InvalidIdentityToken" -// The web identity token that was passed could not be validated by AWS. Get -// a new identity token from the identity provider and then retry the request. -// -// * ErrCodeExpiredTokenException "ExpiredTokenException" -// The web identity token that was passed is expired or is not valid. Get a -// new identity token from the identity provider and then retry the request. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity -func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) (*AssumeRoleWithWebIdentityOutput, error) { - req, out := c.AssumeRoleWithWebIdentityRequest(input) - return out, req.Send() -} - -// AssumeRoleWithWebIdentityWithContext is the same as AssumeRoleWithWebIdentity with the addition of -// the ability to pass a context and additional request options. -// -// See AssumeRoleWithWebIdentity for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) AssumeRoleWithWebIdentityWithContext(ctx aws.Context, input *AssumeRoleWithWebIdentityInput, opts ...request.Option) (*AssumeRoleWithWebIdentityOutput, error) { - req, out := c.AssumeRoleWithWebIdentityRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage" - -// DecodeAuthorizationMessageRequest generates a "aws/request.Request" representing the -// client's request for the DecodeAuthorizationMessage operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DecodeAuthorizationMessage for more information on using the DecodeAuthorizationMessage -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DecodeAuthorizationMessageRequest method. -// req, resp := client.DecodeAuthorizationMessageRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage -func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessageInput) (req *request.Request, output *DecodeAuthorizationMessageOutput) { - op := &request.Operation{ - Name: opDecodeAuthorizationMessage, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DecodeAuthorizationMessageInput{} - } - - output = &DecodeAuthorizationMessageOutput{} - req = c.newRequest(op, input, output) - return -} - -// DecodeAuthorizationMessage API operation for AWS Security Token Service. -// -// Decodes additional information about the authorization status of a request -// from an encoded message returned in response to an AWS request. -// -// For example, if a user is not authorized to perform an action that he or -// she has requested, the request returns a Client.UnauthorizedOperation response -// (an HTTP 403 response). Some AWS actions additionally return an encoded message -// that can provide details about this authorization failure. -// -// Only certain AWS actions return an encoded authorization message. The documentation -// for an individual action indicates whether that action returns an encoded -// message in addition to returning an HTTP code. -// -// The message is encoded because the details of the authorization status can -// constitute privileged information that the user who requested the action -// should not see. To decode an authorization status message, a user must be -// granted permissions via an IAM policy to request the DecodeAuthorizationMessage -// (sts:DecodeAuthorizationMessage) action. -// -// The decoded message includes the following type of information: -// -// * Whether the request was denied due to an explicit deny or due to the -// absence of an explicit allow. For more information, see Determining Whether -// a Request is Allowed or Denied (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow) -// in the IAM User Guide. -// -// * The principal who made the request. -// -// * The requested action. -// -// * The requested resource. -// -// * The values of condition keys in the context of the user's request. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation DecodeAuthorizationMessage for usage and error information. -// -// Returned Error Codes: -// * ErrCodeInvalidAuthorizationMessageException "InvalidAuthorizationMessageException" -// The error returned if the message passed to DecodeAuthorizationMessage was -// invalid. This can happen if the token contains invalid characters, such as -// linebreaks. -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage -func (c *STS) DecodeAuthorizationMessage(input *DecodeAuthorizationMessageInput) (*DecodeAuthorizationMessageOutput, error) { - req, out := c.DecodeAuthorizationMessageRequest(input) - return out, req.Send() -} - -// DecodeAuthorizationMessageWithContext is the same as DecodeAuthorizationMessage with the addition of -// the ability to pass a context and additional request options. -// -// See DecodeAuthorizationMessage for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) DecodeAuthorizationMessageWithContext(ctx aws.Context, input *DecodeAuthorizationMessageInput, opts ...request.Option) (*DecodeAuthorizationMessageOutput, error) { - req, out := c.DecodeAuthorizationMessageRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetCallerIdentity = "GetCallerIdentity" - -// GetCallerIdentityRequest generates a "aws/request.Request" representing the -// client's request for the GetCallerIdentity operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetCallerIdentity for more information on using the GetCallerIdentity -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetCallerIdentityRequest method. -// req, resp := client.GetCallerIdentityRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity -func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *request.Request, output *GetCallerIdentityOutput) { - op := &request.Operation{ - Name: opGetCallerIdentity, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetCallerIdentityInput{} - } - - output = &GetCallerIdentityOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetCallerIdentity API operation for AWS Security Token Service. -// -// Returns details about the IAM identity whose credentials are used to call -// the API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetCallerIdentity for usage and error information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity -func (c *STS) GetCallerIdentity(input *GetCallerIdentityInput) (*GetCallerIdentityOutput, error) { - req, out := c.GetCallerIdentityRequest(input) - return out, req.Send() -} - -// GetCallerIdentityWithContext is the same as GetCallerIdentity with the addition of -// the ability to pass a context and additional request options. -// -// See GetCallerIdentity for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetCallerIdentityWithContext(ctx aws.Context, input *GetCallerIdentityInput, opts ...request.Option) (*GetCallerIdentityOutput, error) { - req, out := c.GetCallerIdentityRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetFederationToken = "GetFederationToken" - -// GetFederationTokenRequest generates a "aws/request.Request" representing the -// client's request for the GetFederationToken operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetFederationToken for more information on using the GetFederationToken -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetFederationTokenRequest method. -// req, resp := client.GetFederationTokenRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken -func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *request.Request, output *GetFederationTokenOutput) { - op := &request.Operation{ - Name: opGetFederationToken, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetFederationTokenInput{} - } - - output = &GetFederationTokenOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetFederationToken API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials (consisting of an access -// key ID, a secret access key, and a security token) for a federated user. -// A typical use is in a proxy application that gets temporary security credentials -// on behalf of distributed applications inside a corporate network. Because -// you must call the GetFederationToken action using the long-term security -// credentials of an IAM user, this call is appropriate in contexts where those -// credentials can be safely stored, usually in a server-based application. -// For a comparison of GetFederationToken with the other APIs that produce temporary -// credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// If you are creating a mobile-based or browser-based app that can authenticate -// users using a web identity provider like Login with Amazon, Facebook, Google, -// or an OpenID Connect-compatible identity provider, we recommend that you -// use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity. -// For more information, see Federation Through a Web-based Identity Provider -// (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). -// -// The GetFederationToken action must be called by using the long-term AWS security -// credentials of an IAM user. You can also call GetFederationToken using the -// security credentials of an AWS root account, but we do not recommended it. -// Instead, we recommend that you create an IAM user for the purpose of the -// proxy application and then attach a policy to the IAM user that limits federated -// users to only the actions and resources that they need access to. For more -// information, see IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) -// in the IAM User Guide. -// -// The temporary security credentials that are obtained by using the long-term -// credentials of an IAM user are valid for the specified duration, from 900 -// seconds (15 minutes) up to a maximium of 129600 seconds (36 hours). The default -// is 43200 seconds (12 hours). Temporary credentials that are obtained by using -// AWS root account credentials have a maximum duration of 3600 seconds (1 hour). -// -// The temporary security credentials created by GetFederationToken can be used -// to make API calls to any AWS service with the following exceptions: -// -// * You cannot use these credentials to call any IAM APIs. -// -// * You cannot call any STS APIs except GetCallerIdentity. -// -// Permissions -// -// The permissions for the temporary security credentials returned by GetFederationToken -// are determined by a combination of the following: -// -// * The policy or policies that are attached to the IAM user whose credentials -// are used to call GetFederationToken. -// -// * The policy that is passed as a parameter in the call. -// -// The passed policy is attached to the temporary security credentials that -// result from the GetFederationToken API call--that is, to the federated user. -// When the federated user makes an AWS request, AWS evaluates the policy attached -// to the federated user in combination with the policy or policies attached -// to the IAM user whose credentials were used to call GetFederationToken. AWS -// allows the federated user's request only when both the federated user and -// the IAM user are explicitly allowed to perform the requested action. The -// passed policy cannot grant more permissions than those that are defined in -// the IAM user policy. -// -// A typical use case is that the permissions of the IAM user whose credentials -// are used to call GetFederationToken are designed to allow access to all the -// actions and resources that any federated user will need. Then, for individual -// users, you pass a policy to the operation that scopes down the permissions -// to a level that's appropriate to that individual user, using a policy that -// allows only a subset of permissions that are granted to the IAM user. -// -// If you do not pass a policy, the resulting temporary security credentials -// have no effective permissions. The only exception is when the temporary security -// credentials are used to access a resource that has a resource-based policy -// that specifically allows the federated user to access the resource. -// -// For more information about how permissions work, see Permissions for GetFederationToken -// (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). -// For information about using GetFederationToken to create temporary security -// credentials, see GetFederationToken—Federation Through a Custom Identity -// Broker (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetFederationToken for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the policy document was too large. The error -// message describes how big the policy document is, in packed form, as a percentage -// of what the API allows. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken -func (c *STS) GetFederationToken(input *GetFederationTokenInput) (*GetFederationTokenOutput, error) { - req, out := c.GetFederationTokenRequest(input) - return out, req.Send() -} - -// GetFederationTokenWithContext is the same as GetFederationToken with the addition of -// the ability to pass a context and additional request options. -// -// See GetFederationToken for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetFederationTokenWithContext(ctx aws.Context, input *GetFederationTokenInput, opts ...request.Option) (*GetFederationTokenOutput, error) { - req, out := c.GetFederationTokenRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetSessionToken = "GetSessionToken" - -// GetSessionTokenRequest generates a "aws/request.Request" representing the -// client's request for the GetSessionToken operation. The "output" return -// value will be populated with the request's response once the request complets -// successfuly. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetSessionToken for more information on using the GetSessionToken -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetSessionTokenRequest method. -// req, resp := client.GetSessionTokenRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken -func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.Request, output *GetSessionTokenOutput) { - op := &request.Operation{ - Name: opGetSessionToken, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetSessionTokenInput{} - } - - output = &GetSessionTokenOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetSessionToken API operation for AWS Security Token Service. -// -// Returns a set of temporary credentials for an AWS account or IAM user. The -// credentials consist of an access key ID, a secret access key, and a security -// token. Typically, you use GetSessionToken if you want to use MFA to protect -// programmatic calls to specific AWS APIs like Amazon EC2 StopInstances. MFA-enabled -// IAM users would need to call GetSessionToken and submit an MFA code that -// is associated with their MFA device. Using the temporary security credentials -// that are returned from the call, IAM users can then make programmatic calls -// to APIs that require MFA authentication. If you do not supply a correct MFA -// code, then the API returns an access denied error. For a comparison of GetSessionToken -// with the other APIs that produce temporary credentials, see Requesting Temporary -// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// The GetSessionToken action must be called by using the long-term AWS security -// credentials of the AWS account or an IAM user. Credentials that are created -// by IAM users are valid for the duration that you specify, from 900 seconds -// (15 minutes) up to a maximum of 129600 seconds (36 hours), with a default -// of 43200 seconds (12 hours); credentials that are created by using account -// credentials can range from 900 seconds (15 minutes) up to a maximum of 3600 -// seconds (1 hour), with a default of 1 hour. -// -// The temporary security credentials created by GetSessionToken can be used -// to make API calls to any AWS service with the following exceptions: -// -// * You cannot call any IAM APIs unless MFA authentication information is -// included in the request. -// -// * You cannot call any STS API exceptAssumeRole or GetCallerIdentity. -// -// We recommend that you do not call GetSessionToken with root account credentials. -// Instead, follow our best practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users) -// by creating one or more IAM users, giving them the necessary permissions, -// and using IAM users for everyday interaction with AWS. -// -// The permissions associated with the temporary security credentials returned -// by GetSessionToken are based on the permissions associated with account or -// IAM user whose credentials are used to call the action. If GetSessionToken -// is called using root account credentials, the temporary credentials have -// root account permissions. Similarly, if GetSessionToken is called using the -// credentials of an IAM user, the temporary credentials have the same permissions -// as the IAM user. -// -// For more information about using GetSessionToken to create temporary credentials, -// go to Temporary Credentials for Users in Untrusted Environments (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken) -// in the IAM User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetSessionToken for usage and error information. -// -// Returned Error Codes: -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken -func (c *STS) GetSessionToken(input *GetSessionTokenInput) (*GetSessionTokenOutput, error) { - req, out := c.GetSessionTokenRequest(input) - return out, req.Send() -} - -// GetSessionTokenWithContext is the same as GetSessionToken with the addition of -// the ability to pass a context and additional request options. -// -// See GetSessionToken for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetSessionTokenWithContext(ctx aws.Context, input *GetSessionTokenInput, opts ...request.Option) (*GetSessionTokenOutput, error) { - req, out := c.GetSessionTokenRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleRequest -type AssumeRoleInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, of the role session. The value can range from 900 - // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set - // to 3600 seconds. - // - // This is separate from the duration of a console session that you might request - // using the returned credentials. The request to the federation endpoint for - // a console sign-in token takes a SessionDuration parameter that specifies - // the maximum length of the console session, separately from the DurationSeconds - // parameter on this API. For more information, see Creating a URL that Enables - // Federated Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. - DurationSeconds *int64 `min:"900" type:"integer"` - - // A unique identifier that is used by third parties when assuming roles in - // their customers' accounts. For each role that the third party can assume, - // they should instruct their customers to ensure the role's trust policy checks - // for the external ID that the third party generated. Each time the third party - // assumes the role, they should pass the customer's external ID. The external - // ID is useful in order to help third parties bind a role to the customer who - // created it. For more information about the external ID, see How to Use an - // External ID When Granting Access to Your AWS Resources to a Third Party (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) - // in the IAM User Guide. - // - // The regex used to validated this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@:/- - ExternalId *string `min:"2" type:"string"` - - // An IAM policy in JSON format. - // - // This parameter is optional. If you pass a policy, the temporary security - // credentials that are returned by the operation have the permissions that - // are allowed by both (the intersection of) the access policy of the role that - // is being assumed, and the policy that you pass. This gives you a way to further - // restrict the permissions for the resulting temporary security credentials. - // You cannot use the passed policy to grant permissions that are in excess - // of those allowed by the access policy of the role that is being assumed. - // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, - // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) - // in the IAM User Guide. - // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. - Policy *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the role to assume. - // - // RoleArn is a required field - RoleArn *string `min:"20" type:"string" required:"true"` - - // An identifier for the assumed role session. - // - // Use the role session name to uniquely identify a session when the same role - // is assumed by different principals or for different reasons. In cross-account - // scenarios, the role session name is visible to, and can be logged by the - // account that owns the role. The role session name is also used in the ARN - // of the assumed role principal. This means that subsequent cross-account API - // requests using the temporary security credentials will expose the role session - // name to the external account in their CloudTrail logs. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - // - // RoleSessionName is a required field - RoleSessionName *string `min:"2" type:"string" required:"true"` - - // The identification number of the MFA device that is associated with the user - // who is making the AssumeRole call. Specify this value if the trust policy - // of the role being assumed includes a condition that requires MFA authentication. - // The value is either the serial number for a hardware device (such as GAHT12345678) - // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - SerialNumber *string `min:"9" type:"string"` - - // The value provided by the MFA device, if the trust policy of the role being - // assumed requires MFA (that is, if the policy includes a condition that tests - // for MFA). If the role being assumed requires MFA and if the TokenCode value - // is missing or expired, the AssumeRole call returns an "access denied" error. - // - // The format for this parameter, as described by its regex pattern, is a sequence - // of six numeric digits. - TokenCode *string `min:"6" type:"string"` -} - -// String returns the string representation -func (s AssumeRoleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AssumeRoleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AssumeRoleInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.ExternalId != nil && len(*s.ExternalId) < 2 { - invalidParams.Add(request.NewErrParamMinLen("ExternalId", 2)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.RoleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RoleArn")) - } - if s.RoleArn != nil && len(*s.RoleArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) - } - if s.RoleSessionName == nil { - invalidParams.Add(request.NewErrParamRequired("RoleSessionName")) - } - if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { - invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2)) - } - if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { - invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9)) - } - if s.TokenCode != nil && len(*s.TokenCode) < 6 { - invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *AssumeRoleInput) SetDurationSeconds(v int64) *AssumeRoleInput { - s.DurationSeconds = &v - return s -} - -// SetExternalId sets the ExternalId field's value. -func (s *AssumeRoleInput) SetExternalId(v string) *AssumeRoleInput { - s.ExternalId = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *AssumeRoleInput) SetPolicy(v string) *AssumeRoleInput { - s.Policy = &v - return s -} - -// SetRoleArn sets the RoleArn field's value. -func (s *AssumeRoleInput) SetRoleArn(v string) *AssumeRoleInput { - s.RoleArn = &v - return s -} - -// SetRoleSessionName sets the RoleSessionName field's value. -func (s *AssumeRoleInput) SetRoleSessionName(v string) *AssumeRoleInput { - s.RoleSessionName = &v - return s -} - -// SetSerialNumber sets the SerialNumber field's value. -func (s *AssumeRoleInput) SetSerialNumber(v string) *AssumeRoleInput { - s.SerialNumber = &v - return s -} - -// SetTokenCode sets the TokenCode field's value. -func (s *AssumeRoleInput) SetTokenCode(v string) *AssumeRoleInput { - s.TokenCode = &v - return s -} - -// Contains the response to a successful AssumeRole request, including temporary -// AWS credentials that can be used to make AWS requests. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleResponse -type AssumeRoleOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers - // that you can use to refer to the resulting temporary security credentials. - // For example, you can reference these credentials as a principal in a resource-based - // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName - // that you specified when you called AssumeRole. - AssumedRoleUser *AssumedRoleUser `type:"structure"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. - Credentials *Credentials `type:"structure"` - - // A percentage value that indicates the size of the policy in packed form. - // The service rejects any policy with a packed size greater than 100 percent, - // which means the policy exceeded the allowed space. - PackedPolicySize *int64 `type:"integer"` -} - -// String returns the string representation -func (s AssumeRoleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleOutput) GoString() string { - return s.String() -} - -// SetAssumedRoleUser sets the AssumedRoleUser field's value. -func (s *AssumeRoleOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleOutput { - s.AssumedRoleUser = v - return s -} - -// SetCredentials sets the Credentials field's value. -func (s *AssumeRoleOutput) SetCredentials(v *Credentials) *AssumeRoleOutput { - s.Credentials = v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *AssumeRoleOutput) SetPackedPolicySize(v int64) *AssumeRoleOutput { - s.PackedPolicySize = &v - return s -} - -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAMLRequest -type AssumeRoleWithSAMLInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, of the role session. The value can range from 900 - // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set - // to 3600 seconds. An expiration can also be specified in the SAML authentication - // response's SessionNotOnOrAfter value. The actual expiration time is whichever - // value is shorter. - // - // This is separate from the duration of a console session that you might request - // using the returned credentials. The request to the federation endpoint for - // a console sign-in token takes a SessionDuration parameter that specifies - // the maximum length of the console session, separately from the DurationSeconds - // parameter on this API. For more information, see Enabling SAML 2.0 Federated - // Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-saml.html) - // in the IAM User Guide. - DurationSeconds *int64 `min:"900" type:"integer"` - - // An IAM policy in JSON format. - // - // The policy parameter is optional. If you pass a policy, the temporary security - // credentials that are returned by the operation have the permissions that - // are allowed by both the access policy of the role that is being assumed, - // and the policy that you pass. This gives you a way to further restrict the - // permissions for the resulting temporary security credentials. You cannot - // use the passed policy to grant permissions that are in excess of those allowed - // by the access policy of the role that is being assumed. For more information, - // Permissions for AssumeRole, AssumeRoleWithSAML, and AssumeRoleWithWebIdentity - // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) - // in the IAM User Guide. - // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. - Policy *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes - // the IdP. - // - // PrincipalArn is a required field - PrincipalArn *string `min:"20" type:"string" required:"true"` - - // The Amazon Resource Name (ARN) of the role that the caller is assuming. - // - // RoleArn is a required field - RoleArn *string `min:"20" type:"string" required:"true"` - - // The base-64 encoded SAML authentication response provided by the IdP. - // - // For more information, see Configuring a Relying Party and Adding Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html) - // in the Using IAM guide. - // - // SAMLAssertion is a required field - SAMLAssertion *string `min:"4" type:"string" required:"true"` -} - -// String returns the string representation -func (s AssumeRoleWithSAMLInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithSAMLInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AssumeRoleWithSAMLInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithSAMLInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.PrincipalArn == nil { - invalidParams.Add(request.NewErrParamRequired("PrincipalArn")) - } - if s.PrincipalArn != nil && len(*s.PrincipalArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("PrincipalArn", 20)) - } - if s.RoleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RoleArn")) - } - if s.RoleArn != nil && len(*s.RoleArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) - } - if s.SAMLAssertion == nil { - invalidParams.Add(request.NewErrParamRequired("SAMLAssertion")) - } - if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 { - invalidParams.Add(request.NewErrParamMinLen("SAMLAssertion", 4)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *AssumeRoleWithSAMLInput) SetDurationSeconds(v int64) *AssumeRoleWithSAMLInput { - s.DurationSeconds = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *AssumeRoleWithSAMLInput) SetPolicy(v string) *AssumeRoleWithSAMLInput { - s.Policy = &v - return s -} - -// SetPrincipalArn sets the PrincipalArn field's value. -func (s *AssumeRoleWithSAMLInput) SetPrincipalArn(v string) *AssumeRoleWithSAMLInput { - s.PrincipalArn = &v - return s -} - -// SetRoleArn sets the RoleArn field's value. -func (s *AssumeRoleWithSAMLInput) SetRoleArn(v string) *AssumeRoleWithSAMLInput { - s.RoleArn = &v - return s -} - -// SetSAMLAssertion sets the SAMLAssertion field's value. -func (s *AssumeRoleWithSAMLInput) SetSAMLAssertion(v string) *AssumeRoleWithSAMLInput { - s.SAMLAssertion = &v - return s -} - -// Contains the response to a successful AssumeRoleWithSAML request, including -// temporary AWS credentials that can be used to make AWS requests. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAMLResponse -type AssumeRoleWithSAMLOutput struct { - _ struct{} `type:"structure"` - - // The identifiers for the temporary security credentials that the operation - // returns. - AssumedRoleUser *AssumedRoleUser `type:"structure"` - - // The value of the Recipient attribute of the SubjectConfirmationData element - // of the SAML assertion. - Audience *string `type:"string"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. - Credentials *Credentials `type:"structure"` - - // The value of the Issuer element of the SAML assertion. - Issuer *string `type:"string"` - - // A hash value based on the concatenation of the Issuer response value, the - // AWS account ID, and the friendly name (the last part of the ARN) of the SAML - // provider in IAM. The combination of NameQualifier and Subject can be used - // to uniquely identify a federated user. - // - // The following pseudocode shows how the hash value is calculated: - // - // BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP" - // ) ) - NameQualifier *string `type:"string"` - - // A percentage value that indicates the size of the policy in packed form. - // The service rejects any policy with a packed size greater than 100 percent, - // which means the policy exceeded the allowed space. - PackedPolicySize *int64 `type:"integer"` - - // The value of the NameID element in the Subject element of the SAML assertion. - Subject *string `type:"string"` - - // The format of the name ID, as defined by the Format attribute in the NameID - // element of the SAML assertion. Typical examples of the format are transient - // or persistent. - // - // If the format includes the prefix urn:oasis:names:tc:SAML:2.0:nameid-format, - // that prefix is removed. For example, urn:oasis:names:tc:SAML:2.0:nameid-format:transient - // is returned as transient. If the format includes any other prefix, the format - // is returned with no modifications. - SubjectType *string `type:"string"` -} - -// String returns the string representation -func (s AssumeRoleWithSAMLOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithSAMLOutput) GoString() string { - return s.String() -} - -// SetAssumedRoleUser sets the AssumedRoleUser field's value. -func (s *AssumeRoleWithSAMLOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleWithSAMLOutput { - s.AssumedRoleUser = v - return s -} - -// SetAudience sets the Audience field's value. -func (s *AssumeRoleWithSAMLOutput) SetAudience(v string) *AssumeRoleWithSAMLOutput { - s.Audience = &v - return s -} - -// SetCredentials sets the Credentials field's value. -func (s *AssumeRoleWithSAMLOutput) SetCredentials(v *Credentials) *AssumeRoleWithSAMLOutput { - s.Credentials = v - return s -} - -// SetIssuer sets the Issuer field's value. -func (s *AssumeRoleWithSAMLOutput) SetIssuer(v string) *AssumeRoleWithSAMLOutput { - s.Issuer = &v - return s -} - -// SetNameQualifier sets the NameQualifier field's value. -func (s *AssumeRoleWithSAMLOutput) SetNameQualifier(v string) *AssumeRoleWithSAMLOutput { - s.NameQualifier = &v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *AssumeRoleWithSAMLOutput) SetPackedPolicySize(v int64) *AssumeRoleWithSAMLOutput { - s.PackedPolicySize = &v - return s -} - -// SetSubject sets the Subject field's value. -func (s *AssumeRoleWithSAMLOutput) SetSubject(v string) *AssumeRoleWithSAMLOutput { - s.Subject = &v - return s -} - -// SetSubjectType sets the SubjectType field's value. -func (s *AssumeRoleWithSAMLOutput) SetSubjectType(v string) *AssumeRoleWithSAMLOutput { - s.SubjectType = &v - return s -} - -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentityRequest -type AssumeRoleWithWebIdentityInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, of the role session. The value can range from 900 - // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set - // to 3600 seconds. - // - // This is separate from the duration of a console session that you might request - // using the returned credentials. The request to the federation endpoint for - // a console sign-in token takes a SessionDuration parameter that specifies - // the maximum length of the console session, separately from the DurationSeconds - // parameter on this API. For more information, see Creating a URL that Enables - // Federated Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. - DurationSeconds *int64 `min:"900" type:"integer"` - - // An IAM policy in JSON format. - // - // The policy parameter is optional. If you pass a policy, the temporary security - // credentials that are returned by the operation have the permissions that - // are allowed by both the access policy of the role that is being assumed, - // and the policy that you pass. This gives you a way to further restrict the - // permissions for the resulting temporary security credentials. You cannot - // use the passed policy to grant permissions that are in excess of those allowed - // by the access policy of the role that is being assumed. For more information, - // see Permissions for AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) - // in the IAM User Guide. - // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. - Policy *string `min:"1" type:"string"` - - // The fully qualified host component of the domain name of the identity provider. - // - // Specify this value only for OAuth 2.0 access tokens. Currently www.amazon.com - // and graph.facebook.com are the only supported identity providers for OAuth - // 2.0 access tokens. Do not include URL schemes and port numbers. - // - // Do not specify this value for OpenID Connect ID tokens. - ProviderId *string `min:"4" type:"string"` - - // The Amazon Resource Name (ARN) of the role that the caller is assuming. - // - // RoleArn is a required field - RoleArn *string `min:"20" type:"string" required:"true"` - - // An identifier for the assumed role session. Typically, you pass the name - // or identifier that is associated with the user who is using your application. - // That way, the temporary security credentials that your application will use - // are associated with that user. This session name is included as part of the - // ARN and assumed role ID in the AssumedRoleUser response element. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - // - // RoleSessionName is a required field - RoleSessionName *string `min:"2" type:"string" required:"true"` - - // The OAuth 2.0 access token or OpenID Connect ID token that is provided by - // the identity provider. Your application must get this token by authenticating - // the user who is using your application with a web identity provider before - // the application makes an AssumeRoleWithWebIdentity call. - // - // WebIdentityToken is a required field - WebIdentityToken *string `min:"4" type:"string" required:"true"` -} - -// String returns the string representation -func (s AssumeRoleWithWebIdentityInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithWebIdentityInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AssumeRoleWithWebIdentityInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithWebIdentityInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.ProviderId != nil && len(*s.ProviderId) < 4 { - invalidParams.Add(request.NewErrParamMinLen("ProviderId", 4)) - } - if s.RoleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RoleArn")) - } - if s.RoleArn != nil && len(*s.RoleArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) - } - if s.RoleSessionName == nil { - invalidParams.Add(request.NewErrParamRequired("RoleSessionName")) - } - if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { - invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2)) - } - if s.WebIdentityToken == nil { - invalidParams.Add(request.NewErrParamRequired("WebIdentityToken")) - } - if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 { - invalidParams.Add(request.NewErrParamMinLen("WebIdentityToken", 4)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *AssumeRoleWithWebIdentityInput) SetDurationSeconds(v int64) *AssumeRoleWithWebIdentityInput { - s.DurationSeconds = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *AssumeRoleWithWebIdentityInput) SetPolicy(v string) *AssumeRoleWithWebIdentityInput { - s.Policy = &v - return s -} - -// SetProviderId sets the ProviderId field's value. -func (s *AssumeRoleWithWebIdentityInput) SetProviderId(v string) *AssumeRoleWithWebIdentityInput { - s.ProviderId = &v - return s -} - -// SetRoleArn sets the RoleArn field's value. -func (s *AssumeRoleWithWebIdentityInput) SetRoleArn(v string) *AssumeRoleWithWebIdentityInput { - s.RoleArn = &v - return s -} - -// SetRoleSessionName sets the RoleSessionName field's value. -func (s *AssumeRoleWithWebIdentityInput) SetRoleSessionName(v string) *AssumeRoleWithWebIdentityInput { - s.RoleSessionName = &v - return s -} - -// SetWebIdentityToken sets the WebIdentityToken field's value. -func (s *AssumeRoleWithWebIdentityInput) SetWebIdentityToken(v string) *AssumeRoleWithWebIdentityInput { - s.WebIdentityToken = &v - return s -} - -// Contains the response to a successful AssumeRoleWithWebIdentity request, -// including temporary AWS credentials that can be used to make AWS requests. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentityResponse -type AssumeRoleWithWebIdentityOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers - // that you can use to refer to the resulting temporary security credentials. - // For example, you can reference these credentials as a principal in a resource-based - // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName - // that you specified when you called AssumeRole. - AssumedRoleUser *AssumedRoleUser `type:"structure"` - - // The intended audience (also known as client ID) of the web identity token. - // This is traditionally the client identifier issued to the application that - // requested the web identity token. - Audience *string `type:"string"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security token. - // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. - Credentials *Credentials `type:"structure"` - - // A percentage value that indicates the size of the policy in packed form. - // The service rejects any policy with a packed size greater than 100 percent, - // which means the policy exceeded the allowed space. - PackedPolicySize *int64 `type:"integer"` - - // The issuing authority of the web identity token presented. For OpenID Connect - // ID Tokens this contains the value of the iss field. For OAuth 2.0 access - // tokens, this contains the value of the ProviderId parameter that was passed - // in the AssumeRoleWithWebIdentity request. - Provider *string `type:"string"` - - // The unique user identifier that is returned by the identity provider. This - // identifier is associated with the WebIdentityToken that was submitted with - // the AssumeRoleWithWebIdentity call. The identifier is typically unique to - // the user and the application that acquired the WebIdentityToken (pairwise - // identifier). For OpenID Connect ID tokens, this field contains the value - // returned by the identity provider as the token's sub (Subject) claim. - SubjectFromWebIdentityToken *string `min:"6" type:"string"` -} - -// String returns the string representation -func (s AssumeRoleWithWebIdentityOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithWebIdentityOutput) GoString() string { - return s.String() -} - -// SetAssumedRoleUser sets the AssumedRoleUser field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleWithWebIdentityOutput { - s.AssumedRoleUser = v - return s -} - -// SetAudience sets the Audience field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetAudience(v string) *AssumeRoleWithWebIdentityOutput { - s.Audience = &v - return s -} - -// SetCredentials sets the Credentials field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetCredentials(v *Credentials) *AssumeRoleWithWebIdentityOutput { - s.Credentials = v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetPackedPolicySize(v int64) *AssumeRoleWithWebIdentityOutput { - s.PackedPolicySize = &v - return s -} - -// SetProvider sets the Provider field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetProvider(v string) *AssumeRoleWithWebIdentityOutput { - s.Provider = &v - return s -} - -// SetSubjectFromWebIdentityToken sets the SubjectFromWebIdentityToken field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetSubjectFromWebIdentityToken(v string) *AssumeRoleWithWebIdentityOutput { - s.SubjectFromWebIdentityToken = &v - return s -} - -// The identifiers for the temporary security credentials that the operation -// returns. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumedRoleUser -type AssumedRoleUser struct { - _ struct{} `type:"structure"` - - // The ARN of the temporary security credentials that are returned from the - // AssumeRole action. For more information about ARNs and how to use them in - // policies, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) - // in Using IAM. - // - // Arn is a required field - Arn *string `min:"20" type:"string" required:"true"` - - // A unique identifier that contains the role ID and the role session name of - // the role that is being assumed. The role ID is generated by AWS when the - // role is created. - // - // AssumedRoleId is a required field - AssumedRoleId *string `min:"2" type:"string" required:"true"` -} - -// String returns the string representation -func (s AssumedRoleUser) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumedRoleUser) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *AssumedRoleUser) SetArn(v string) *AssumedRoleUser { - s.Arn = &v - return s -} - -// SetAssumedRoleId sets the AssumedRoleId field's value. -func (s *AssumedRoleUser) SetAssumedRoleId(v string) *AssumedRoleUser { - s.AssumedRoleId = &v - return s -} - -// AWS credentials for API authentication. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/Credentials -type Credentials struct { - _ struct{} `type:"structure"` - - // The access key ID that identifies the temporary security credentials. - // - // AccessKeyId is a required field - AccessKeyId *string `min:"16" type:"string" required:"true"` - - // The date on which the current credentials expire. - // - // Expiration is a required field - Expiration *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` - - // The secret access key that can be used to sign requests. - // - // SecretAccessKey is a required field - SecretAccessKey *string `type:"string" required:"true"` - - // The token that users must pass to the service API to use the temporary credentials. - // - // SessionToken is a required field - SessionToken *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s Credentials) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Credentials) GoString() string { - return s.String() -} - -// SetAccessKeyId sets the AccessKeyId field's value. -func (s *Credentials) SetAccessKeyId(v string) *Credentials { - s.AccessKeyId = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *Credentials) SetExpiration(v time.Time) *Credentials { - s.Expiration = &v - return s -} - -// SetSecretAccessKey sets the SecretAccessKey field's value. -func (s *Credentials) SetSecretAccessKey(v string) *Credentials { - s.SecretAccessKey = &v - return s -} - -// SetSessionToken sets the SessionToken field's value. -func (s *Credentials) SetSessionToken(v string) *Credentials { - s.SessionToken = &v - return s -} - -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessageRequest -type DecodeAuthorizationMessageInput struct { - _ struct{} `type:"structure"` - - // The encoded message that was returned with the response. - // - // EncodedMessage is a required field - EncodedMessage *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation -func (s DecodeAuthorizationMessageInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DecodeAuthorizationMessageInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DecodeAuthorizationMessageInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DecodeAuthorizationMessageInput"} - if s.EncodedMessage == nil { - invalidParams.Add(request.NewErrParamRequired("EncodedMessage")) - } - if s.EncodedMessage != nil && len(*s.EncodedMessage) < 1 { - invalidParams.Add(request.NewErrParamMinLen("EncodedMessage", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncodedMessage sets the EncodedMessage field's value. -func (s *DecodeAuthorizationMessageInput) SetEncodedMessage(v string) *DecodeAuthorizationMessageInput { - s.EncodedMessage = &v - return s -} - -// A document that contains additional information about the authorization status -// of a request from an encoded message that is returned in response to an AWS -// request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessageResponse -type DecodeAuthorizationMessageOutput struct { - _ struct{} `type:"structure"` - - // An XML document that contains the decoded message. - DecodedMessage *string `type:"string"` -} - -// String returns the string representation -func (s DecodeAuthorizationMessageOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DecodeAuthorizationMessageOutput) GoString() string { - return s.String() -} - -// SetDecodedMessage sets the DecodedMessage field's value. -func (s *DecodeAuthorizationMessageOutput) SetDecodedMessage(v string) *DecodeAuthorizationMessageOutput { - s.DecodedMessage = &v - return s -} - -// Identifiers for the federated user that is associated with the credentials. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/FederatedUser -type FederatedUser struct { - _ struct{} `type:"structure"` - - // The ARN that specifies the federated user that is associated with the credentials. - // For more information about ARNs and how to use them in policies, see IAM - // Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) - // in Using IAM. - // - // Arn is a required field - Arn *string `min:"20" type:"string" required:"true"` - - // The string that identifies the federated user associated with the credentials, - // similar to the unique ID of an IAM user. - // - // FederatedUserId is a required field - FederatedUserId *string `min:"2" type:"string" required:"true"` -} - -// String returns the string representation -func (s FederatedUser) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s FederatedUser) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *FederatedUser) SetArn(v string) *FederatedUser { - s.Arn = &v - return s -} - -// SetFederatedUserId sets the FederatedUserId field's value. -func (s *FederatedUser) SetFederatedUserId(v string) *FederatedUser { - s.FederatedUserId = &v - return s -} - -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentityRequest -type GetCallerIdentityInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s GetCallerIdentityInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetCallerIdentityInput) GoString() string { - return s.String() -} - -// Contains the response to a successful GetCallerIdentity request, including -// information about the entity making the request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentityResponse -type GetCallerIdentityOutput struct { - _ struct{} `type:"structure"` - - // The AWS account ID number of the account that owns or contains the calling - // entity. - Account *string `type:"string"` - - // The AWS ARN associated with the calling entity. - Arn *string `min:"20" type:"string"` - - // The unique identifier of the calling entity. The exact value depends on the - // type of entity making the call. The values returned are those listed in the - // aws:userid column in the Principal table (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) - // found on the Policy Variables reference page in the IAM User Guide. - UserId *string `type:"string"` -} - -// String returns the string representation -func (s GetCallerIdentityOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetCallerIdentityOutput) GoString() string { - return s.String() -} - -// SetAccount sets the Account field's value. -func (s *GetCallerIdentityOutput) SetAccount(v string) *GetCallerIdentityOutput { - s.Account = &v - return s -} - -// SetArn sets the Arn field's value. -func (s *GetCallerIdentityOutput) SetArn(v string) *GetCallerIdentityOutput { - s.Arn = &v - return s -} - -// SetUserId sets the UserId field's value. -func (s *GetCallerIdentityOutput) SetUserId(v string) *GetCallerIdentityOutput { - s.UserId = &v - return s -} - -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationTokenRequest -type GetFederationTokenInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, that the session should last. Acceptable durations - // for federation sessions range from 900 seconds (15 minutes) to 129600 seconds - // (36 hours), with 43200 seconds (12 hours) as the default. Sessions obtained - // using AWS account (root) credentials are restricted to a maximum of 3600 - // seconds (one hour). If the specified duration is longer than one hour, the - // session obtained by using AWS account (root) credentials defaults to one - // hour. - DurationSeconds *int64 `min:"900" type:"integer"` - - // The name of the federated user. The name is used as an identifier for the - // temporary security credentials (such as Bob). For example, you can reference - // the federated user name in a resource-based policy, such as in an Amazon - // S3 bucket policy. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - // - // Name is a required field - Name *string `min:"2" type:"string" required:"true"` - - // An IAM policy in JSON format that is passed with the GetFederationToken call - // and evaluated along with the policy or policies that are attached to the - // IAM user whose credentials are used to call GetFederationToken. The passed - // policy is used to scope down the permissions that are available to the IAM - // user, by allowing only a subset of the permissions that are granted to the - // IAM user. The passed policy cannot grant more permissions than those granted - // to the IAM user. The final permissions for the federated user are the most - // restrictive set based on the intersection of the passed policy and the IAM - // user policy. - // - // If you do not pass a policy, the resulting temporary security credentials - // have no effective permissions. The only exception is when the temporary security - // credentials are used to access a resource that has a resource-based policy - // that specifically allows the federated user to access the resource. - // - // The format for this parameter, as described by its regex pattern, is a string - // of characters up to 2048 characters in length. The characters can be any - // ASCII character from the space character to the end of the valid character - // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. - // - // For more information about how permissions work, see Permissions for GetFederationToken - // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). - Policy *string `min:"1" type:"string"` -} - -// String returns the string representation -func (s GetFederationTokenInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetFederationTokenInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetFederationTokenInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetFederationTokenInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - if s.Name != nil && len(*s.Name) < 2 { - invalidParams.Add(request.NewErrParamMinLen("Name", 2)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *GetFederationTokenInput) SetDurationSeconds(v int64) *GetFederationTokenInput { - s.DurationSeconds = &v - return s -} - -// SetName sets the Name field's value. -func (s *GetFederationTokenInput) SetName(v string) *GetFederationTokenInput { - s.Name = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *GetFederationTokenInput) SetPolicy(v string) *GetFederationTokenInput { - s.Policy = &v - return s -} - -// Contains the response to a successful GetFederationToken request, including -// temporary AWS credentials that can be used to make AWS requests. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationTokenResponse -type GetFederationTokenOutput struct { - _ struct{} `type:"structure"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. - Credentials *Credentials `type:"structure"` - - // Identifiers for the federated user associated with the credentials (such - // as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob). You - // can use the federated user's ARN in your resource-based policies, such as - // an Amazon S3 bucket policy. - FederatedUser *FederatedUser `type:"structure"` - - // A percentage value indicating the size of the policy in packed form. The - // service rejects policies for which the packed size is greater than 100 percent - // of the allowed value. - PackedPolicySize *int64 `type:"integer"` -} - -// String returns the string representation -func (s GetFederationTokenOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetFederationTokenOutput) GoString() string { - return s.String() -} - -// SetCredentials sets the Credentials field's value. -func (s *GetFederationTokenOutput) SetCredentials(v *Credentials) *GetFederationTokenOutput { - s.Credentials = v - return s -} - -// SetFederatedUser sets the FederatedUser field's value. -func (s *GetFederationTokenOutput) SetFederatedUser(v *FederatedUser) *GetFederationTokenOutput { - s.FederatedUser = v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *GetFederationTokenOutput) SetPackedPolicySize(v int64) *GetFederationTokenOutput { - s.PackedPolicySize = &v - return s -} - -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionTokenRequest -type GetSessionTokenInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, that the credentials should remain valid. Acceptable - // durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 - // seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions - // for AWS account owners are restricted to a maximum of 3600 seconds (one hour). - // If the duration is longer than one hour, the session for AWS account owners - // defaults to one hour. - DurationSeconds *int64 `min:"900" type:"integer"` - - // The identification number of the MFA device that is associated with the IAM - // user who is making the GetSessionToken call. Specify this value if the IAM - // user has a policy that requires MFA authentication. The value is either the - // serial number for a hardware device (such as GAHT12345678) or an Amazon Resource - // Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). - // You can find the device for an IAM user by going to the AWS Management Console - // and viewing the user's security credentials. - // - // The regex used to validated this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@:/- - SerialNumber *string `min:"9" type:"string"` - - // The value provided by the MFA device, if MFA is required. If any policy requires - // the IAM user to submit an MFA code, specify this value. If MFA authentication - // is required, and the user does not provide a code when requesting a set of - // temporary security credentials, the user will receive an "access denied" - // response when requesting resources that require MFA authentication. - // - // The format for this parameter, as described by its regex pattern, is a sequence - // of six numeric digits. - TokenCode *string `min:"6" type:"string"` -} - -// String returns the string representation -func (s GetSessionTokenInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetSessionTokenInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetSessionTokenInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetSessionTokenInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { - invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9)) - } - if s.TokenCode != nil && len(*s.TokenCode) < 6 { - invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *GetSessionTokenInput) SetDurationSeconds(v int64) *GetSessionTokenInput { - s.DurationSeconds = &v - return s -} - -// SetSerialNumber sets the SerialNumber field's value. -func (s *GetSessionTokenInput) SetSerialNumber(v string) *GetSessionTokenInput { - s.SerialNumber = &v - return s -} - -// SetTokenCode sets the TokenCode field's value. -func (s *GetSessionTokenInput) SetTokenCode(v string) *GetSessionTokenInput { - s.TokenCode = &v - return s -} - -// Contains the response to a successful GetSessionToken request, including -// temporary AWS credentials that can be used to make AWS requests. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionTokenResponse -type GetSessionTokenOutput struct { - _ struct{} `type:"structure"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // Note: The size of the security token that STS APIs return is not fixed. We - // strongly recommend that you make no assumptions about the maximum size. As - // of this writing, the typical size is less than 4096 bytes, but that can vary. - // Also, future updates to AWS might require larger sizes. - Credentials *Credentials `type:"structure"` -} - -// String returns the string representation -func (s GetSessionTokenOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetSessionTokenOutput) GoString() string { - return s.String() -} - -// SetCredentials sets the Credentials field's value. -func (s *GetSessionTokenOutput) SetCredentials(v *Credentials) *GetSessionTokenOutput { - s.Credentials = v - return s -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go deleted file mode 100644 index 4010cc7f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go +++ /dev/null @@ -1,12 +0,0 @@ -package sts - -import "github.com/aws/aws-sdk-go/aws/request" - -func init() { - initRequest = func(r *request.Request) { - switch r.Operation.Name { - case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: - r.Handlers.Sign.Clear() // these operations are unsigned - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/sts/customizations_test.go deleted file mode 100644 index 18972b1f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package sts_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/sts" -) - -var svc = sts.New(unit.Session, &aws.Config{ - Region: aws.String("mock-region"), -}) - -func TestUnsignedRequest_AssumeRoleWithSAML(t *testing.T) { - req, _ := svc.AssumeRoleWithSAMLRequest(&sts.AssumeRoleWithSAMLInput{ - PrincipalArn: aws.String("ARN01234567890123456789"), - RoleArn: aws.String("ARN01234567890123456789"), - SAMLAssertion: aws.String("ASSERT"), - }) - - err := req.Sign() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} - -func TestUnsignedRequest_AssumeRoleWithWebIdentity(t *testing.T) { - req, _ := svc.AssumeRoleWithWebIdentityRequest(&sts.AssumeRoleWithWebIdentityInput{ - RoleArn: aws.String("ARN01234567890123456789"), - RoleSessionName: aws.String("SESSION"), - WebIdentityToken: aws.String("TOKEN"), - }) - - err := req.Sign() - if err != nil { - t.Errorf("expect no error, got %v", err) - } - if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a { - t.Errorf("expect %v, got %v", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go b/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go deleted file mode 100644 index a43fa805..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package sts provides the client and types for making API -// requests to AWS Security Token Service. -// -// The AWS Security Token Service (STS) is a web service that enables you to -// request temporary, limited-privilege credentials for AWS Identity and Access -// Management (IAM) users or for users that you authenticate (federated users). -// This guide provides descriptions of the STS API. For more detailed information -// about using this service, go to Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). -// -// As an alternative to using the API, you can use one of the AWS SDKs, which -// consist of libraries and sample code for various programming languages and -// platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient -// way to create programmatic access to STS. For example, the SDKs take care -// of cryptographically signing requests, managing errors, and retrying requests -// automatically. For information about the AWS SDKs, including how to download -// and install them, see the Tools for Amazon Web Services page (http://aws.amazon.com/tools/). -// -// For information about setting up signatures and authorization through the -// API, go to Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) -// in the AWS General Reference. For general information about the Query API, -// go to Making Query Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) -// in Using IAM. For information about using security tokens with other AWS -// products, go to AWS Services That Work with IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) -// in the IAM User Guide. -// -// If you're new to AWS and need additional technical information about a specific -// AWS product, you can find the product's technical documentation at http://aws.amazon.com/documentation/ -// (http://aws.amazon.com/documentation/). -// -// Endpoints -// -// The AWS Security Token Service (STS) has a default endpoint of https://sts.amazonaws.com -// that maps to the US East (N. Virginia) region. Additional regions are available -// and are activated by default. For more information, see Activating and Deactivating -// AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// For information about STS endpoints, see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#sts_region) -// in the AWS General Reference. -// -// Recording API requests -// -// STS supports AWS CloudTrail, which is a service that records AWS calls for -// your AWS account and delivers log files to an Amazon S3 bucket. By using -// information collected by CloudTrail, you can determine what requests were -// successfully made to STS, who made the request, when it was made, and so -// on. To learn more about CloudTrail, including how to turn it on and find -// your log files, see the AWS CloudTrail User Guide (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html). -// -// See https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15 for more information on this service. -// -// See sts package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/ -// -// Using the Client -// -// To AWS Security Token Service with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the AWS Security Token Service client STS for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/#New -package sts diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go b/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go deleted file mode 100644 index e24884ef..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package sts - -const ( - - // ErrCodeExpiredTokenException for service response error code - // "ExpiredTokenException". - // - // The web identity token that was passed is expired or is not valid. Get a - // new identity token from the identity provider and then retry the request. - ErrCodeExpiredTokenException = "ExpiredTokenException" - - // ErrCodeIDPCommunicationErrorException for service response error code - // "IDPCommunicationError". - // - // The request could not be fulfilled because the non-AWS identity provider - // (IDP) that was asked to verify the incoming identity token could not be reached. - // This is often a transient error caused by network conditions. Retry the request - // a limited number of times so that you don't exceed the request rate. If the - // error persists, the non-AWS identity provider might be down or not responding. - ErrCodeIDPCommunicationErrorException = "IDPCommunicationError" - - // ErrCodeIDPRejectedClaimException for service response error code - // "IDPRejectedClaim". - // - // The identity provider (IdP) reported that authentication failed. This might - // be because the claim is invalid. - // - // If this error is returned for the AssumeRoleWithWebIdentity operation, it - // can also mean that the claim has expired or has been explicitly revoked. - ErrCodeIDPRejectedClaimException = "IDPRejectedClaim" - - // ErrCodeInvalidAuthorizationMessageException for service response error code - // "InvalidAuthorizationMessageException". - // - // The error returned if the message passed to DecodeAuthorizationMessage was - // invalid. This can happen if the token contains invalid characters, such as - // linebreaks. - ErrCodeInvalidAuthorizationMessageException = "InvalidAuthorizationMessageException" - - // ErrCodeInvalidIdentityTokenException for service response error code - // "InvalidIdentityToken". - // - // The web identity token that was passed could not be validated by AWS. Get - // a new identity token from the identity provider and then retry the request. - ErrCodeInvalidIdentityTokenException = "InvalidIdentityToken" - - // ErrCodeMalformedPolicyDocumentException for service response error code - // "MalformedPolicyDocument". - // - // The request was rejected because the policy document was malformed. The error - // message describes the specific error. - ErrCodeMalformedPolicyDocumentException = "MalformedPolicyDocument" - - // ErrCodePackedPolicyTooLargeException for service response error code - // "PackedPolicyTooLarge". - // - // The request was rejected because the policy document was too large. The error - // message describes how big the policy document is, in packed form, as a percentage - // of what the API allows. - ErrCodePackedPolicyTooLargeException = "PackedPolicyTooLarge" - - // ErrCodeRegionDisabledException for service response error code - // "RegionDisabledException". - // - // STS is not activated in the requested region for the account that is being - // asked to generate credentials. The account administrator must use the IAM - // console to activate STS in that region. For more information, see Activating - // and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) - // in the IAM User Guide. - ErrCodeRegionDisabledException = "RegionDisabledException" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/sts/examples_test.go deleted file mode 100644 index d61a9932..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/examples_test.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package sts_test - -import ( - "fmt" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/sts" -) - -var _ time.Duration -var _ strings.Reader -var _ aws.Config - -func parseTime(layout, value string) *time.Time { - t, err := time.Parse(layout, value) - if err != nil { - panic(err) - } - return &t -} - -// To assume a role -// - -func ExampleSTS_AssumeRole_shared00() { - svc := sts.New(session.New()) - input := &sts.AssumeRoleInput{ - DurationSeconds: aws.Int64(3600), - ExternalId: aws.String("123ABC"), - Policy: aws.String("{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Stmt1\",\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}"), - RoleArn: aws.String("arn:aws:iam::123456789012:role/demo"), - RoleSessionName: aws.String("Bob"), - } - - result, err := svc.AssumeRole(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case sts.ErrCodeMalformedPolicyDocumentException: - fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error()) - case sts.ErrCodePackedPolicyTooLargeException: - fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error()) - case sts.ErrCodeRegionDisabledException: - fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error()) - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} - -// To assume a role as an OpenID Connect-federated user -// - -func ExampleSTS_AssumeRoleWithWebIdentity_shared00() { - svc := sts.New(session.New()) - input := &sts.AssumeRoleWithWebIdentityInput{ - DurationSeconds: aws.Int64(3600), - ProviderId: aws.String("www.amazon.com"), - RoleArn: aws.String("arn:aws:iam::123456789012:role/FederatedWebIdentityRole"), - RoleSessionName: aws.String("app1"), - WebIdentityToken: aws.String("Atza%7CIQEBLjAsAhRFiXuWpUXuRvQ9PZL3GMFcYevydwIUFAHZwXZXXXXXXXXJnrulxKDHwy87oGKPznh0D6bEQZTSCzyoCtL_8S07pLpr0zMbn6w1lfVZKNTBdDansFBmtGnIsIapjI6xKR02Yc_2bQ8LZbUXSGm6Ry6_BG7PrtLZtj_dfCTj92xNGed-CrKqjG7nPBjNIL016GGvuS5gSvPRUxWES3VYfm1wl7WTI7jn-Pcb6M-buCgHhFOzTQxod27L9CqnOLio7N3gZAGpsp6n1-AJBOCJckcyXe2c6uD0srOJeZlKUm2eTDVMf8IehDVI0r1QOnTV6KzzAI3OY87Vd_cVMQ"), - } - - result, err := svc.AssumeRoleWithWebIdentity(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case sts.ErrCodeMalformedPolicyDocumentException: - fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error()) - case sts.ErrCodePackedPolicyTooLargeException: - fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error()) - case sts.ErrCodeIDPRejectedClaimException: - fmt.Println(sts.ErrCodeIDPRejectedClaimException, aerr.Error()) - case sts.ErrCodeIDPCommunicationErrorException: - fmt.Println(sts.ErrCodeIDPCommunicationErrorException, aerr.Error()) - case sts.ErrCodeInvalidIdentityTokenException: - fmt.Println(sts.ErrCodeInvalidIdentityTokenException, aerr.Error()) - case sts.ErrCodeExpiredTokenException: - fmt.Println(sts.ErrCodeExpiredTokenException, aerr.Error()) - case sts.ErrCodeRegionDisabledException: - fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error()) - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} - -// To decode information about an authorization status of a request -// - -func ExampleSTS_DecodeAuthorizationMessage_shared00() { - svc := sts.New(session.New()) - input := &sts.DecodeAuthorizationMessageInput{ - EncodedMessage: aws.String(""), - } - - result, err := svc.DecodeAuthorizationMessage(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case sts.ErrCodeInvalidAuthorizationMessageException: - fmt.Println(sts.ErrCodeInvalidAuthorizationMessageException, aerr.Error()) - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} - -// To get details about a calling IAM user -// -// This example shows a request and response made with the credentials for a user named -// Alice in the AWS account 123456789012. -func ExampleSTS_GetCallerIdentity_shared00() { - svc := sts.New(session.New()) - input := &sts.GetCallerIdentityInput{} - - result, err := svc.GetCallerIdentity(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} - -// To get details about a calling user federated with AssumeRole -// -// This example shows a request and response made with temporary credentials created -// by AssumeRole. The name of the assumed role is my-role-name, and the RoleSessionName -// is set to my-role-session-name. -func ExampleSTS_GetCallerIdentity_shared01() { - svc := sts.New(session.New()) - input := &sts.GetCallerIdentityInput{} - - result, err := svc.GetCallerIdentity(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} - -// To get details about a calling user federated with GetFederationToken -// -// This example shows a request and response made with temporary credentials created -// by using GetFederationToken. The Name parameter is set to my-federated-user-name. -func ExampleSTS_GetCallerIdentity_shared02() { - svc := sts.New(session.New()) - input := &sts.GetCallerIdentityInput{} - - result, err := svc.GetCallerIdentity(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} - -// To get temporary credentials for a role by using GetFederationToken -// - -func ExampleSTS_GetFederationToken_shared00() { - svc := sts.New(session.New()) - input := &sts.GetFederationTokenInput{ - DurationSeconds: aws.Int64(3600), - Name: aws.String("Bob"), - Policy: aws.String("{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Stmt1\",\"Effect\":\"Allow\",\"Action\":\"s3:*\",\"Resource\":\"*\"}]}"), - } - - result, err := svc.GetFederationToken(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case sts.ErrCodeMalformedPolicyDocumentException: - fmt.Println(sts.ErrCodeMalformedPolicyDocumentException, aerr.Error()) - case sts.ErrCodePackedPolicyTooLargeException: - fmt.Println(sts.ErrCodePackedPolicyTooLargeException, aerr.Error()) - case sts.ErrCodeRegionDisabledException: - fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error()) - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} - -// To get temporary credentials for an IAM user or an AWS account -// - -func ExampleSTS_GetSessionToken_shared00() { - svc := sts.New(session.New()) - input := &sts.GetSessionTokenInput{ - DurationSeconds: aws.Int64(3600), - SerialNumber: aws.String("YourMFASerialNumber"), - TokenCode: aws.String("123456"), - } - - result, err := svc.GetSessionToken(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case sts.ErrCodeRegionDisabledException: - fmt.Println(sts.ErrCodeRegionDisabledException, aerr.Error()) - default: - fmt.Println(aerr.Error()) - } - } else { - // Print the error, cast err to awserr.Error to get the Code and - // Message from an error. - fmt.Println(err.Error()) - } - return - } - - fmt.Println(result) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/service.go b/vendor/github.com/aws/aws-sdk-go/service/sts/service.go deleted file mode 100644 index 1ee5839e..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/service.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package sts - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/private/protocol/query" -) - -// STS provides the API operation methods for making requests to -// AWS Security Token Service. See this package's package overview docs -// for details on the service. -// -// STS methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type STS struct { - *client.Client -} - -// Used for custom client initialization logic -var initClient func(*client.Client) - -// Used for custom request initialization logic -var initRequest func(*request.Request) - -// Service information constants -const ( - ServiceName = "sts" // Service endpoint prefix API calls made to. - EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. -) - -// New creates a new instance of the STS client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// // Create a STS client from just a session. -// svc := sts.New(mySession) -// -// // Create a STS client with additional configuration -// svc := sts.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *STS { - c := p.ClientConfig(EndpointsID, cfgs...) - return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *STS { - svc := &STS{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2011-06-15", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a STS operation and runs any -// custom request initialization. -func (c *STS) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - // Run custom request initialization if present - if initRequest != nil { - initRequest(req) - } - - return req -} diff --git a/vendor/github.com/beorn7/perks/.gitignore b/vendor/github.com/beorn7/perks/.gitignore deleted file mode 100644 index 1bd9209a..00000000 --- a/vendor/github.com/beorn7/perks/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.test -*.prof diff --git a/vendor/github.com/beorn7/perks/LICENSE b/vendor/github.com/beorn7/perks/LICENSE deleted file mode 100644 index 339177be..00000000 --- a/vendor/github.com/beorn7/perks/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013 Blake Mizerany - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/beorn7/perks/README.md b/vendor/github.com/beorn7/perks/README.md deleted file mode 100644 index fc057777..00000000 --- a/vendor/github.com/beorn7/perks/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Perks for Go (golang.org) - -Perks contains the Go package quantile that computes approximate quantiles over -an unbounded data stream within low memory and CPU bounds. - -For more information and examples, see: -http://godoc.org/github.com/bmizerany/perks - -A very special thank you and shout out to Graham Cormode (Rutgers University), -Flip Korn (AT&T Labs–Research), S. Muthukrishnan (Rutgers University), and -Divesh Srivastava (AT&T Labs–Research) for their research and publication of -[Effective Computation of Biased Quantiles over Data Streams](http://www.cs.rutgers.edu/~muthu/bquant.pdf) - -Thank you, also: -* Armon Dadgar (@armon) -* Andrew Gerrand (@nf) -* Brad Fitzpatrick (@bradfitz) -* Keith Rarick (@kr) - -FAQ: - -Q: Why not move the quantile package into the project root? -A: I want to add more packages to perks later. - -Copyright (C) 2013 Blake Mizerany - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/beorn7/perks/quantile/bench_test.go b/vendor/github.com/beorn7/perks/quantile/bench_test.go deleted file mode 100644 index 0bd0e4e7..00000000 --- a/vendor/github.com/beorn7/perks/quantile/bench_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package quantile - -import ( - "testing" -) - -func BenchmarkInsertTargeted(b *testing.B) { - b.ReportAllocs() - - s := NewTargeted(Targets) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkInsertTargetedSmallEpsilon(b *testing.B) { - s := NewTargeted(TargetsSmallEpsilon) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkInsertBiased(b *testing.B) { - s := NewLowBiased(0.01) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkInsertBiasedSmallEpsilon(b *testing.B) { - s := NewLowBiased(0.0001) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkQuery(b *testing.B) { - s := NewTargeted(Targets) - for i := float64(0); i < 1e6; i++ { - s.Insert(i) - } - b.ResetTimer() - n := float64(b.N) - for i := float64(0); i < n; i++ { - s.Query(i / n) - } -} - -func BenchmarkQuerySmallEpsilon(b *testing.B) { - s := NewTargeted(TargetsSmallEpsilon) - for i := float64(0); i < 1e6; i++ { - s.Insert(i) - } - b.ResetTimer() - n := float64(b.N) - for i := float64(0); i < n; i++ { - s.Query(i / n) - } -} diff --git a/vendor/github.com/beorn7/perks/quantile/example_test.go b/vendor/github.com/beorn7/perks/quantile/example_test.go deleted file mode 100644 index ab3293aa..00000000 --- a/vendor/github.com/beorn7/perks/quantile/example_test.go +++ /dev/null @@ -1,121 +0,0 @@ -// +build go1.1 - -package quantile_test - -import ( - "bufio" - "fmt" - "log" - "os" - "strconv" - "time" - - "github.com/beorn7/perks/quantile" -) - -func Example_simple() { - ch := make(chan float64) - go sendFloats(ch) - - // Compute the 50th, 90th, and 99th percentile. - q := quantile.NewTargeted(map[float64]float64{ - 0.50: 0.005, - 0.90: 0.001, - 0.99: 0.0001, - }) - for v := range ch { - q.Insert(v) - } - - fmt.Println("perc50:", q.Query(0.50)) - fmt.Println("perc90:", q.Query(0.90)) - fmt.Println("perc99:", q.Query(0.99)) - fmt.Println("count:", q.Count()) - // Output: - // perc50: 5 - // perc90: 16 - // perc99: 223 - // count: 2388 -} - -func Example_mergeMultipleStreams() { - // Scenario: - // We have multiple database shards. On each shard, there is a process - // collecting query response times from the database logs and inserting - // them into a Stream (created via NewTargeted(0.90)), much like the - // Simple example. These processes expose a network interface for us to - // ask them to serialize and send us the results of their - // Stream.Samples so we may Merge and Query them. - // - // NOTES: - // * These sample sets are small, allowing us to get them - // across the network much faster than sending the entire list of data - // points. - // - // * For this to work correctly, we must supply the same quantiles - // a priori the process collecting the samples supplied to NewTargeted, - // even if we do not plan to query them all here. - ch := make(chan quantile.Samples) - getDBQuerySamples(ch) - q := quantile.NewTargeted(map[float64]float64{0.90: 0.001}) - for samples := range ch { - q.Merge(samples) - } - fmt.Println("perc90:", q.Query(0.90)) -} - -func Example_window() { - // Scenario: We want the 90th, 95th, and 99th percentiles for each - // minute. - - ch := make(chan float64) - go sendStreamValues(ch) - - tick := time.NewTicker(1 * time.Minute) - q := quantile.NewTargeted(map[float64]float64{ - 0.90: 0.001, - 0.95: 0.0005, - 0.99: 0.0001, - }) - for { - select { - case t := <-tick.C: - flushToDB(t, q.Samples()) - q.Reset() - case v := <-ch: - q.Insert(v) - } - } -} - -func sendStreamValues(ch chan float64) { - // Use your imagination -} - -func flushToDB(t time.Time, samples quantile.Samples) { - // Use your imagination -} - -// This is a stub for the above example. In reality this would hit the remote -// servers via http or something like it. -func getDBQuerySamples(ch chan quantile.Samples) {} - -func sendFloats(ch chan<- float64) { - f, err := os.Open("exampledata.txt") - if err != nil { - log.Fatal(err) - } - sc := bufio.NewScanner(f) - for sc.Scan() { - b := sc.Bytes() - v, err := strconv.ParseFloat(string(b), 64) - if err != nil { - log.Fatal(err) - } - ch <- v - } - if sc.Err() != nil { - log.Fatal(sc.Err()) - } - close(ch) -} diff --git a/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt deleted file mode 100644 index 1602287d..00000000 --- a/vendor/github.com/beorn7/perks/quantile/exampledata.txt +++ /dev/null @@ -1,2388 +0,0 @@ -8 -5 -26 -12 -5 -235 -13 -6 -28 -30 -3 -3 -3 -3 -5 -2 -33 -7 -2 -4 -7 -12 -14 -5 -8 -3 -10 -4 -5 -3 -6 -6 -209 -20 -3 -10 -14 -3 -4 -6 -8 -5 -11 -7 -3 -2 -3 -3 -212 -5 -222 -4 -10 -10 -5 -6 -3 -8 -3 -10 -254 -220 -2 -3 -5 -24 -5 -4 -222 -7 -3 -3 -223 -8 -15 -12 -14 -14 -3 -2 -2 -3 -13 -3 -11 -4 -4 -6 -5 -7 -13 -5 -3 -5 -2 -5 -3 -5 -2 -7 -15 -17 -14 -3 -6 -6 -3 -17 -5 -4 -7 -6 -4 -4 -8 -6 -8 -3 -9 -3 -6 -3 -4 -5 -3 -3 -660 -4 -6 -10 -3 -6 -3 -2 -5 -13 -2 -4 -4 -10 -4 -8 -4 -3 -7 -9 -9 -3 -10 -37 -3 -13 -4 -12 -3 -6 -10 -8 -5 -21 -2 -3 -8 -3 -2 -3 -3 -4 -12 -2 -4 -8 -8 -4 -3 -2 -20 -1 -6 -32 -2 -11 -6 -18 -3 -8 -11 -3 -212 -3 -4 -2 -6 -7 -12 -11 -3 -2 -16 -10 -6 -4 -6 -3 -2 -7 -3 -2 -2 -2 -2 -5 -6 -4 -3 -10 -3 -4 -6 -5 -3 -4 -4 -5 -6 -4 -3 -4 -4 -5 -7 -5 -5 -3 -2 -7 -2 -4 -12 -4 -5 -6 -2 -4 -4 -8 -4 -15 -13 -7 -16 -5 -3 -23 -5 -5 -7 -3 -2 -9 -8 -7 -5 -8 -11 -4 -10 -76 -4 -47 -4 -3 -2 -7 -4 -2 -3 -37 -10 -4 -2 -20 -5 -4 -4 -10 -10 -4 -3 -7 -23 -240 -7 -13 -5 -5 -3 -3 -2 -5 -4 -2 -8 -7 -19 -2 -23 -8 -7 -2 -5 -3 -8 -3 -8 -13 -5 -5 -5 -2 -3 -23 -4 -9 -8 -4 -3 -3 -5 -220 -2 -3 -4 -6 -14 -3 -53 -6 -2 -5 -18 -6 -3 -219 -6 -5 -2 -5 -3 -6 -5 -15 -4 -3 -17 -3 -2 -4 -7 -2 -3 -3 -4 -4 -3 -2 -664 -6 -3 -23 -5 -5 -16 -5 -8 -2 -4 -2 -24 -12 -3 -2 -3 -5 -8 -3 -5 -4 -3 -14 -3 -5 -8 -2 -3 -7 -9 -4 -2 -3 -6 -8 -4 -3 -4 -6 -5 -3 -3 -6 -3 -19 -4 -4 -6 -3 -6 -3 -5 -22 -5 -4 -4 -3 -8 -11 -4 -9 -7 -6 -13 -4 -4 -4 -6 -17 -9 -3 -3 -3 -4 -3 -221 -5 -11 -3 -4 -2 -12 -6 -3 -5 -7 -5 -7 -4 -9 -7 -14 -37 -19 -217 -16 -3 -5 -2 -2 -7 -19 -7 -6 -7 -4 -24 -5 -11 -4 -7 -7 -9 -13 -3 -4 -3 -6 -28 -4 -4 -5 -5 -2 -5 -6 -4 -4 -6 -10 -5 -4 -3 -2 -3 -3 -6 -5 -5 -4 -3 -2 -3 -7 -4 -6 -18 -16 -8 -16 -4 -5 -8 -6 -9 -13 -1545 -6 -215 -6 -5 -6 -3 -45 -31 -5 -2 -2 -4 -3 -3 -2 -5 -4 -3 -5 -7 -7 -4 -5 -8 -5 -4 -749 -2 -31 -9 -11 -2 -11 -5 -4 -4 -7 -9 -11 -4 -5 -4 -7 -3 -4 -6 -2 -15 -3 -4 -3 -4 -3 -5 -2 -13 -5 -5 -3 -3 -23 -4 -4 -5 -7 -4 -13 -2 -4 -3 -4 -2 -6 -2 -7 -3 -5 -5 -3 -29 -5 -4 -4 -3 -10 -2 -3 -79 -16 -6 -6 -7 -7 -3 -5 -5 -7 -4 -3 -7 -9 -5 -6 -5 -9 -6 -3 -6 -4 -17 -2 -10 -9 -3 -6 -2 -3 -21 -22 -5 -11 -4 -2 -17 -2 -224 -2 -14 -3 -4 -4 -2 -4 -4 -4 -4 -5 -3 -4 -4 -10 -2 -6 -3 -3 -5 -7 -2 -7 -5 -6 -3 -218 -2 -2 -5 -2 -6 -3 -5 -222 -14 -6 -33 -3 -2 -5 -3 -3 -3 -9 -5 -3 -3 -2 -7 -4 -3 -4 -3 -5 -6 -5 -26 -4 -13 -9 -7 -3 -221 -3 -3 -4 -4 -4 -4 -2 -18 -5 -3 -7 -9 -6 -8 -3 -10 -3 -11 -9 -5 -4 -17 -5 -5 -6 -6 -3 -2 -4 -12 -17 -6 -7 -218 -4 -2 -4 -10 -3 -5 -15 -3 -9 -4 -3 -3 -6 -29 -3 -3 -4 -5 -5 -3 -8 -5 -6 -6 -7 -5 -3 -5 -3 -29 -2 -31 -5 -15 -24 -16 -5 -207 -4 -3 -3 -2 -15 -4 -4 -13 -5 -5 -4 -6 -10 -2 -7 -8 -4 -6 -20 -5 -3 -4 -3 -12 -12 -5 -17 -7 -3 -3 -3 -6 -10 -3 -5 -25 -80 -4 -9 -3 -2 -11 -3 -3 -2 -3 -8 -7 -5 -5 -19 -5 -3 -3 -12 -11 -2 -6 -5 -5 -5 -3 -3 -3 -4 -209 -14 -3 -2 -5 -19 -4 -4 -3 -4 -14 -5 -6 -4 -13 -9 -7 -4 -7 -10 -2 -9 -5 -7 -2 -8 -4 -6 -5 -5 -222 -8 -7 -12 -5 -216 -3 -4 -4 -6 -3 -14 -8 -7 -13 -4 -3 -3 -3 -3 -17 -5 -4 -3 -33 -6 -6 -33 -7 -5 -3 -8 -7 -5 -2 -9 -4 -2 -233 -24 -7 -4 -8 -10 -3 -4 -15 -2 -16 -3 -3 -13 -12 -7 -5 -4 -207 -4 -2 -4 -27 -15 -2 -5 -2 -25 -6 -5 -5 -6 -13 -6 -18 -6 -4 -12 -225 -10 -7 -5 -2 -2 -11 -4 -14 -21 -8 -10 -3 -5 -4 -232 -2 -5 -5 -3 -7 -17 -11 -6 -6 -23 -4 -6 -3 -5 -4 -2 -17 -3 -6 -5 -8 -3 -2 -2 -14 -9 -4 -4 -2 -5 -5 -3 -7 -6 -12 -6 -10 -3 -6 -2 -2 -19 -5 -4 -4 -9 -2 -4 -13 -3 -5 -6 -3 -6 -5 -4 -9 -6 -3 -5 -7 -3 -6 -6 -4 -3 -10 -6 -3 -221 -3 -5 -3 -6 -4 -8 -5 -3 -6 -4 -4 -2 -54 -5 -6 -11 -3 -3 -4 -4 -4 -3 -7 -3 -11 -11 -7 -10 -6 -13 -223 -213 -15 -231 -7 -3 -7 -228 -2 -3 -4 -4 -5 -6 -7 -4 -13 -3 -4 -5 -3 -6 -4 -6 -7 -2 -4 -3 -4 -3 -3 -6 -3 -7 -3 -5 -18 -5 -6 -8 -10 -3 -3 -3 -2 -4 -2 -4 -4 -5 -6 -6 -4 -10 -13 -3 -12 -5 -12 -16 -8 -4 -19 -11 -2 -4 -5 -6 -8 -5 -6 -4 -18 -10 -4 -2 -216 -6 -6 -6 -2 -4 -12 -8 -3 -11 -5 -6 -14 -5 -3 -13 -4 -5 -4 -5 -3 -28 -6 -3 -7 -219 -3 -9 -7 -3 -10 -6 -3 -4 -19 -5 -7 -11 -6 -15 -19 -4 -13 -11 -3 -7 -5 -10 -2 -8 -11 -2 -6 -4 -6 -24 -6 -3 -3 -3 -3 -6 -18 -4 -11 -4 -2 -5 -10 -8 -3 -9 -5 -3 -4 -5 -6 -2 -5 -7 -4 -4 -14 -6 -4 -4 -5 -5 -7 -2 -4 -3 -7 -3 -3 -6 -4 -5 -4 -4 -4 -3 -3 -3 -3 -8 -14 -2 -3 -5 -3 -2 -4 -5 -3 -7 -3 -3 -18 -3 -4 -4 -5 -7 -3 -3 -3 -13 -5 -4 -8 -211 -5 -5 -3 -5 -2 -5 -4 -2 -655 -6 -3 -5 -11 -2 -5 -3 -12 -9 -15 -11 -5 -12 -217 -2 -6 -17 -3 -3 -207 -5 -5 -4 -5 -9 -3 -2 -8 -5 -4 -3 -2 -5 -12 -4 -14 -5 -4 -2 -13 -5 -8 -4 -225 -4 -3 -4 -5 -4 -3 -3 -6 -23 -9 -2 -6 -7 -233 -4 -4 -6 -18 -3 -4 -6 -3 -4 -4 -2 -3 -7 -4 -13 -227 -4 -3 -5 -4 -2 -12 -9 -17 -3 -7 -14 -6 -4 -5 -21 -4 -8 -9 -2 -9 -25 -16 -3 -6 -4 -7 -8 -5 -2 -3 -5 -4 -3 -3 -5 -3 -3 -3 -2 -3 -19 -2 -4 -3 -4 -2 -3 -4 -4 -2 -4 -3 -3 -3 -2 -6 -3 -17 -5 -6 -4 -3 -13 -5 -3 -3 -3 -4 -9 -4 -2 -14 -12 -4 -5 -24 -4 -3 -37 -12 -11 -21 -3 -4 -3 -13 -4 -2 -3 -15 -4 -11 -4 -4 -3 -8 -3 -4 -4 -12 -8 -5 -3 -3 -4 -2 -220 -3 -5 -223 -3 -3 -3 -10 -3 -15 -4 -241 -9 -7 -3 -6 -6 -23 -4 -13 -7 -3 -4 -7 -4 -9 -3 -3 -4 -10 -5 -5 -1 -5 -24 -2 -4 -5 -5 -6 -14 -3 -8 -2 -3 -5 -13 -13 -3 -5 -2 -3 -15 -3 -4 -2 -10 -4 -4 -4 -5 -5 -3 -5 -3 -4 -7 -4 -27 -3 -6 -4 -15 -3 -5 -6 -6 -5 -4 -8 -3 -9 -2 -6 -3 -4 -3 -7 -4 -18 -3 -11 -3 -3 -8 -9 -7 -24 -3 -219 -7 -10 -4 -5 -9 -12 -2 -5 -4 -4 -4 -3 -3 -19 -5 -8 -16 -8 -6 -22 -3 -23 -3 -242 -9 -4 -3 -3 -5 -7 -3 -3 -5 -8 -3 -7 -5 -14 -8 -10 -3 -4 -3 -7 -4 -6 -7 -4 -10 -4 -3 -11 -3 -7 -10 -3 -13 -6 -8 -12 -10 -5 -7 -9 -3 -4 -7 -7 -10 -8 -30 -9 -19 -4 -3 -19 -15 -4 -13 -3 -215 -223 -4 -7 -4 -8 -17 -16 -3 -7 -6 -5 -5 -4 -12 -3 -7 -4 -4 -13 -4 -5 -2 -5 -6 -5 -6 -6 -7 -10 -18 -23 -9 -3 -3 -6 -5 -2 -4 -2 -7 -3 -3 -2 -5 -5 -14 -10 -224 -6 -3 -4 -3 -7 -5 -9 -3 -6 -4 -2 -5 -11 -4 -3 -3 -2 -8 -4 -7 -4 -10 -7 -3 -3 -18 -18 -17 -3 -3 -3 -4 -5 -3 -3 -4 -12 -7 -3 -11 -13 -5 -4 -7 -13 -5 -4 -11 -3 -12 -3 -6 -4 -4 -21 -4 -6 -9 -5 -3 -10 -8 -4 -6 -4 -4 -6 -5 -4 -8 -6 -4 -6 -4 -4 -5 -9 -6 -3 -4 -2 -9 -3 -18 -2 -4 -3 -13 -3 -6 -6 -8 -7 -9 -3 -2 -16 -3 -4 -6 -3 -2 -33 -22 -14 -4 -9 -12 -4 -5 -6 -3 -23 -9 -4 -3 -5 -5 -3 -4 -5 -3 -5 -3 -10 -4 -5 -5 -8 -4 -4 -6 -8 -5 -4 -3 -4 -6 -3 -3 -3 -5 -9 -12 -6 -5 -9 -3 -5 -3 -2 -2 -2 -18 -3 -2 -21 -2 -5 -4 -6 -4 -5 -10 -3 -9 -3 -2 -10 -7 -3 -6 -6 -4 -4 -8 -12 -7 -3 -7 -3 -3 -9 -3 -4 -5 -4 -4 -5 -5 -10 -15 -4 -4 -14 -6 -227 -3 -14 -5 -216 -22 -5 -4 -2 -2 -6 -3 -4 -2 -9 -9 -4 -3 -28 -13 -11 -4 -5 -3 -3 -2 -3 -3 -5 -3 -4 -3 -5 -23 -26 -3 -4 -5 -6 -4 -6 -3 -5 -5 -3 -4 -3 -2 -2 -2 -7 -14 -3 -6 -7 -17 -2 -2 -15 -14 -16 -4 -6 -7 -13 -6 -4 -5 -6 -16 -3 -3 -28 -3 -6 -15 -3 -9 -2 -4 -6 -3 -3 -22 -4 -12 -6 -7 -2 -5 -4 -10 -3 -16 -6 -9 -2 -5 -12 -7 -5 -5 -5 -5 -2 -11 -9 -17 -4 -3 -11 -7 -3 -5 -15 -4 -3 -4 -211 -8 -7 -5 -4 -7 -6 -7 -6 -3 -6 -5 -6 -5 -3 -4 -4 -26 -4 -6 -10 -4 -4 -3 -2 -3 -3 -4 -5 -9 -3 -9 -4 -4 -5 -5 -8 -2 -4 -2 -3 -8 -4 -11 -19 -5 -8 -6 -3 -5 -6 -12 -3 -2 -4 -16 -12 -3 -4 -4 -8 -6 -5 -6 -6 -219 -8 -222 -6 -16 -3 -13 -19 -5 -4 -3 -11 -6 -10 -4 -7 -7 -12 -5 -3 -3 -5 -6 -10 -3 -8 -2 -5 -4 -7 -2 -4 -4 -2 -12 -9 -6 -4 -2 -40 -2 -4 -10 -4 -223 -4 -2 -20 -6 -7 -24 -5 -4 -5 -2 -20 -16 -6 -5 -13 -2 -3 -3 -19 -3 -2 -4 -5 -6 -7 -11 -12 -5 -6 -7 -7 -3 -5 -3 -5 -3 -14 -3 -4 -4 -2 -11 -1 -7 -3 -9 -6 -11 -12 -5 -8 -6 -221 -4 -2 -12 -4 -3 -15 -4 -5 -226 -7 -218 -7 -5 -4 -5 -18 -4 -5 -9 -4 -4 -2 -9 -18 -18 -9 -5 -6 -6 -3 -3 -7 -3 -5 -4 -4 -4 -12 -3 -6 -31 -5 -4 -7 -3 -6 -5 -6 -5 -11 -2 -2 -11 -11 -6 -7 -5 -8 -7 -10 -5 -23 -7 -4 -3 -5 -34 -2 -5 -23 -7 -3 -6 -8 -4 -4 -4 -2 -5 -3 -8 -5 -4 -8 -25 -2 -3 -17 -8 -3 -4 -8 -7 -3 -15 -6 -5 -7 -21 -9 -5 -6 -6 -5 -3 -2 -3 -10 -3 -6 -3 -14 -7 -4 -4 -8 -7 -8 -2 -6 -12 -4 -213 -6 -5 -21 -8 -2 -5 -23 -3 -11 -2 -3 -6 -25 -2 -3 -6 -7 -6 -6 -4 -4 -6 -3 -17 -9 -7 -6 -4 -3 -10 -7 -2 -3 -3 -3 -11 -8 -3 -7 -6 -4 -14 -36 -3 -4 -3 -3 -22 -13 -21 -4 -2 -7 -4 -4 -17 -15 -3 -7 -11 -2 -4 -7 -6 -209 -6 -3 -2 -2 -24 -4 -9 -4 -3 -3 -3 -29 -2 -2 -4 -3 -3 -5 -4 -6 -3 -3 -2 -4 diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go deleted file mode 100644 index f4cabd66..00000000 --- a/vendor/github.com/beorn7/perks/quantile/stream.go +++ /dev/null @@ -1,292 +0,0 @@ -// Package quantile computes approximate quantiles over an unbounded data -// stream within low memory and CPU bounds. -// -// A small amount of accuracy is traded to achieve the above properties. -// -// Multiple streams can be merged before calling Query to generate a single set -// of results. This is meaningful when the streams represent the same type of -// data. See Merge and Samples. -// -// For more detailed information about the algorithm used, see: -// -// Effective Computation of Biased Quantiles over Data Streams -// -// http://www.cs.rutgers.edu/~muthu/bquant.pdf -package quantile - -import ( - "math" - "sort" -) - -// Sample holds an observed value and meta information for compression. JSON -// tags have been added for convenience. -type Sample struct { - Value float64 `json:",string"` - Width float64 `json:",string"` - Delta float64 `json:",string"` -} - -// Samples represents a slice of samples. It implements sort.Interface. -type Samples []Sample - -func (a Samples) Len() int { return len(a) } -func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value } -func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] } - -type invariant func(s *stream, r float64) float64 - -// NewLowBiased returns an initialized Stream for low-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the lower ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within (1±Epsilon)*Quantile. -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewLowBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * r - } - return newStream(ƒ) -} - -// NewHighBiased returns an initialized Stream for high-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the higher ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewHighBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * (s.n - r) - } - return newStream(ƒ) -} - -// NewTargeted returns an initialized Stream concerned with a particular set of -// quantile values that are supplied a priori. Knowing these a priori reduces -// space and computation time. The targets map maps the desired quantiles to -// their absolute errors, i.e. the true quantile of a value returned by a query -// is guaranteed to be within (Quantile±Epsilon). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. -func NewTargeted(targets map[float64]float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - var m = math.MaxFloat64 - var f float64 - for quantile, epsilon := range targets { - if quantile*s.n <= r { - f = (2 * epsilon * r) / quantile - } else { - f = (2 * epsilon * (s.n - r)) / (1 - quantile) - } - if f < m { - m = f - } - } - return m - } - return newStream(ƒ) -} - -// Stream computes quantiles for a stream of float64s. It is not thread-safe by -// design. Take care when using across multiple goroutines. -type Stream struct { - *stream - b Samples - sorted bool -} - -func newStream(ƒ invariant) *Stream { - x := &stream{ƒ: ƒ} - return &Stream{x, make(Samples, 0, 500), true} -} - -// Insert inserts v into the stream. -func (s *Stream) Insert(v float64) { - s.insert(Sample{Value: v, Width: 1}) -} - -func (s *Stream) insert(sample Sample) { - s.b = append(s.b, sample) - s.sorted = false - if len(s.b) == cap(s.b) { - s.flush() - } -} - -// Query returns the computed qth percentiles value. If s was created with -// NewTargeted, and q is not in the set of quantiles provided a priori, Query -// will return an unspecified result. -func (s *Stream) Query(q float64) float64 { - if !s.flushed() { - // Fast path when there hasn't been enough data for a flush; - // this also yields better accuracy for small sets of data. - l := len(s.b) - if l == 0 { - return 0 - } - i := int(math.Ceil(float64(l) * q)) - if i > 0 { - i -= 1 - } - s.maybeSort() - return s.b[i].Value - } - s.flush() - return s.stream.query(q) -} - -// Merge merges samples into the underlying streams samples. This is handy when -// merging multiple streams from separate threads, database shards, etc. -// -// ATTENTION: This method is broken and does not yield correct results. The -// underlying algorithm is not capable of merging streams correctly. -func (s *Stream) Merge(samples Samples) { - sort.Sort(samples) - s.stream.merge(samples) -} - -// Reset reinitializes and clears the list reusing the samples buffer memory. -func (s *Stream) Reset() { - s.stream.reset() - s.b = s.b[:0] -} - -// Samples returns stream samples held by s. -func (s *Stream) Samples() Samples { - if !s.flushed() { - return s.b - } - s.flush() - return s.stream.samples() -} - -// Count returns the total number of samples observed in the stream -// since initialization. -func (s *Stream) Count() int { - return len(s.b) + s.stream.count() -} - -func (s *Stream) flush() { - s.maybeSort() - s.stream.merge(s.b) - s.b = s.b[:0] -} - -func (s *Stream) maybeSort() { - if !s.sorted { - s.sorted = true - sort.Sort(s.b) - } -} - -func (s *Stream) flushed() bool { - return len(s.stream.l) > 0 -} - -type stream struct { - n float64 - l []Sample - ƒ invariant -} - -func (s *stream) reset() { - s.l = s.l[:0] - s.n = 0 -} - -func (s *stream) insert(v float64) { - s.merge(Samples{{v, 1, 0}}) -} - -func (s *stream) merge(samples Samples) { - // TODO(beorn7): This tries to merge not only individual samples, but - // whole summaries. The paper doesn't mention merging summaries at - // all. Unittests show that the merging is inaccurate. Find out how to - // do merges properly. - var r float64 - i := 0 - for _, sample := range samples { - for ; i < len(s.l); i++ { - c := s.l[i] - if c.Value > sample.Value { - // Insert at position i. - s.l = append(s.l, Sample{}) - copy(s.l[i+1:], s.l[i:]) - s.l[i] = Sample{ - sample.Value, - sample.Width, - math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1), - // TODO(beorn7): How to calculate delta correctly? - } - i++ - goto inserted - } - r += c.Width - } - s.l = append(s.l, Sample{sample.Value, sample.Width, 0}) - i++ - inserted: - s.n += sample.Width - r += sample.Width - } - s.compress() -} - -func (s *stream) count() int { - return int(s.n) -} - -func (s *stream) query(q float64) float64 { - t := math.Ceil(q * s.n) - t += math.Ceil(s.ƒ(s, t) / 2) - p := s.l[0] - var r float64 - for _, c := range s.l[1:] { - r += p.Width - if r+c.Width+c.Delta > t { - return p.Value - } - p = c - } - return p.Value -} - -func (s *stream) compress() { - if len(s.l) < 2 { - return - } - x := s.l[len(s.l)-1] - xi := len(s.l) - 1 - r := s.n - 1 - x.Width - - for i := len(s.l) - 2; i >= 0; i-- { - c := s.l[i] - if c.Width+x.Width+x.Delta <= s.ƒ(s, r) { - x.Width += c.Width - s.l[xi] = x - // Remove element at i. - copy(s.l[i:], s.l[i+1:]) - s.l = s.l[:len(s.l)-1] - xi -= 1 - } else { - x = c - xi = i - } - r -= c.Width - } -} - -func (s *stream) samples() Samples { - samples := make(Samples, len(s.l)) - copy(samples, s.l) - return samples -} diff --git a/vendor/github.com/beorn7/perks/quantile/stream_test.go b/vendor/github.com/beorn7/perks/quantile/stream_test.go deleted file mode 100644 index 85519509..00000000 --- a/vendor/github.com/beorn7/perks/quantile/stream_test.go +++ /dev/null @@ -1,215 +0,0 @@ -package quantile - -import ( - "math" - "math/rand" - "sort" - "testing" -) - -var ( - Targets = map[float64]float64{ - 0.01: 0.001, - 0.10: 0.01, - 0.50: 0.05, - 0.90: 0.01, - 0.99: 0.001, - } - TargetsSmallEpsilon = map[float64]float64{ - 0.01: 0.0001, - 0.10: 0.001, - 0.50: 0.005, - 0.90: 0.001, - 0.99: 0.0001, - } - LowQuantiles = []float64{0.01, 0.1, 0.5} - HighQuantiles = []float64{0.99, 0.9, 0.5} -) - -const RelativeEpsilon = 0.01 - -func verifyPercsWithAbsoluteEpsilon(t *testing.T, a []float64, s *Stream) { - sort.Float64s(a) - for quantile, epsilon := range Targets { - n := float64(len(a)) - k := int(quantile * n) - if k < 1 { - k = 1 - } - lower := int((quantile - epsilon) * n) - if lower < 1 { - lower = 1 - } - upper := int(math.Ceil((quantile + epsilon) * n)) - if upper > len(a) { - upper = len(a) - } - w, min, max := a[k-1], a[lower-1], a[upper-1] - if g := s.Query(quantile); g < min || g > max { - t.Errorf("q=%f: want %v [%f,%f], got %v", quantile, w, min, max, g) - } - } -} - -func verifyLowPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) { - sort.Float64s(a) - for _, qu := range LowQuantiles { - n := float64(len(a)) - k := int(qu * n) - - lowerRank := int((1 - RelativeEpsilon) * qu * n) - upperRank := int(math.Ceil((1 + RelativeEpsilon) * qu * n)) - w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1] - if g := s.Query(qu); g < min || g > max { - t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g) - } - } -} - -func verifyHighPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) { - sort.Float64s(a) - for _, qu := range HighQuantiles { - n := float64(len(a)) - k := int(qu * n) - - lowerRank := int((1 - (1+RelativeEpsilon)*(1-qu)) * n) - upperRank := int(math.Ceil((1 - (1-RelativeEpsilon)*(1-qu)) * n)) - w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1] - if g := s.Query(qu); g < min || g > max { - t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g) - } - } -} - -func populateStream(s *Stream) []float64 { - a := make([]float64, 0, 1e5+100) - for i := 0; i < cap(a); i++ { - v := rand.NormFloat64() - // Add 5% asymmetric outliers. - if i%20 == 0 { - v = v*v + 1 - } - s.Insert(v) - a = append(a, v) - } - return a -} - -func TestTargetedQuery(t *testing.T) { - rand.Seed(42) - s := NewTargeted(Targets) - a := populateStream(s) - verifyPercsWithAbsoluteEpsilon(t, a, s) -} - -func TestTargetedQuerySmallSampleSize(t *testing.T) { - rand.Seed(42) - s := NewTargeted(TargetsSmallEpsilon) - a := []float64{1, 2, 3, 4, 5} - for _, v := range a { - s.Insert(v) - } - verifyPercsWithAbsoluteEpsilon(t, a, s) - // If not yet flushed, results should be precise: - if !s.flushed() { - for φ, want := range map[float64]float64{ - 0.01: 1, - 0.10: 1, - 0.50: 3, - 0.90: 5, - 0.99: 5, - } { - if got := s.Query(φ); got != want { - t.Errorf("want %f for φ=%f, got %f", want, φ, got) - } - } - } -} - -func TestLowBiasedQuery(t *testing.T) { - rand.Seed(42) - s := NewLowBiased(RelativeEpsilon) - a := populateStream(s) - verifyLowPercsWithRelativeEpsilon(t, a, s) -} - -func TestHighBiasedQuery(t *testing.T) { - rand.Seed(42) - s := NewHighBiased(RelativeEpsilon) - a := populateStream(s) - verifyHighPercsWithRelativeEpsilon(t, a, s) -} - -// BrokenTestTargetedMerge is broken, see Merge doc comment. -func BrokenTestTargetedMerge(t *testing.T) { - rand.Seed(42) - s1 := NewTargeted(Targets) - s2 := NewTargeted(Targets) - a := populateStream(s1) - a = append(a, populateStream(s2)...) - s1.Merge(s2.Samples()) - verifyPercsWithAbsoluteEpsilon(t, a, s1) -} - -// BrokenTestLowBiasedMerge is broken, see Merge doc comment. -func BrokenTestLowBiasedMerge(t *testing.T) { - rand.Seed(42) - s1 := NewLowBiased(RelativeEpsilon) - s2 := NewLowBiased(RelativeEpsilon) - a := populateStream(s1) - a = append(a, populateStream(s2)...) - s1.Merge(s2.Samples()) - verifyLowPercsWithRelativeEpsilon(t, a, s2) -} - -// BrokenTestHighBiasedMerge is broken, see Merge doc comment. -func BrokenTestHighBiasedMerge(t *testing.T) { - rand.Seed(42) - s1 := NewHighBiased(RelativeEpsilon) - s2 := NewHighBiased(RelativeEpsilon) - a := populateStream(s1) - a = append(a, populateStream(s2)...) - s1.Merge(s2.Samples()) - verifyHighPercsWithRelativeEpsilon(t, a, s2) -} - -func TestUncompressed(t *testing.T) { - q := NewTargeted(Targets) - for i := 100; i > 0; i-- { - q.Insert(float64(i)) - } - if g := q.Count(); g != 100 { - t.Errorf("want count 100, got %d", g) - } - // Before compression, Query should have 100% accuracy. - for quantile := range Targets { - w := quantile * 100 - if g := q.Query(quantile); g != w { - t.Errorf("want %f, got %f", w, g) - } - } -} - -func TestUncompressedSamples(t *testing.T) { - q := NewTargeted(map[float64]float64{0.99: 0.001}) - for i := 1; i <= 100; i++ { - q.Insert(float64(i)) - } - if g := q.Samples().Len(); g != 100 { - t.Errorf("want count 100, got %d", g) - } -} - -func TestUncompressedOne(t *testing.T) { - q := NewTargeted(map[float64]float64{0.99: 0.01}) - q.Insert(3.14) - if g := q.Query(0.90); g != 3.14 { - t.Error("want PI, got", g) - } -} - -func TestDefaults(t *testing.T) { - if g := NewTargeted(map[float64]float64{0.99: 0.001}).Query(0.99); g != 0 { - t.Errorf("want 0, got %f", g) - } -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/LICENSE.md b/vendor/github.com/bitmovin/bitmovin-go/LICENSE.md deleted file mode 100644 index b8cdcde9..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/LICENSE.md +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2017 Bitmovin Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/bitmovin/bitmovin-go/README.md b/vendor/github.com/bitmovin/bitmovin-go/README.md deleted file mode 100644 index d71119fe..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/README.md +++ /dev/null @@ -1,322 +0,0 @@ -# [![bitmovin](https://cloudfront-prod.bitmovin.com/wp-content/themes/Bitmovin-V-0.1/images/logo3.png)](http://www.bitmovin.com) -Golang-Client which enables you to seamlessly integrate the [Bitmovin API](https://bitmovin.com/video-infrastructure-service-bitmovin-api/) into your projects. -Using this API client requires an active account. [Sign up for a Bitmovin API key](https://bitmovin.com/bitmovins-video-api/). - -The full [Bitmovin API reference](https://bitmovin.com/encoding-documentation/bitmovin-api/) can be found on our website. - -Installation ------------- - -Run `go get github.com/bitmovin/bitmovin-go` - -Also feel free to use your favorite go dependency manager such as glide. - -Example ------ -The following example creates a simple transcoding job with a HTTP Input and a S3 Output ([create_simple_encoding.go](https://github.com/bitmovin/bitmovin-go/blob/master/examples/create_simple_encoding_dash.go)): -```go -package main - -import ( - "fmt" - "time" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/bitmovintypes" - "github.com/bitmovin/bitmovin-go/models" - "github.com/bitmovin/bitmovin-go/services" -) - -func main() { - // Creating Bitmovin object - bitmovin := bitmovin.NewBitmovin("YOUR API KEY", "https://api.bitmovin.com/v1/", 5) - - // Creating the HTTP Input - httpIS := services.NewHTTPInputService(bitmovin) - httpInput := &models.HTTPInput{ - Host: stringToPtr("YOUR HTTP HOST"), - } - httpResp, err := httpIS.Create(httpInput) - errorHandler(httpResp.Status, err) - - s3OS := services.NewS3OutputService(bitmovin) - s3Output := &models.S3Output{ - AccessKey: stringToPtr("YOUR_ACCESS_KEY"), - SecretKey: stringToPtr("YOUR_SECRET_KEY"), - BucketName: stringToPtr("YOUR_BUCKET_NAME"), - CloudRegion: bitmovintypes.AWSCloudRegionEUWest1, - } - s3OutputResp, err := s3OS.Create(s3Output) - errorHandler(s3OutputResp.Status, err) - - encodingS := services.NewEncodingService(bitmovin) - encoding := &models.Encoding{ - Name: stringToPtr("example encoding"), - CloudRegion: bitmovintypes.CloudRegionGoogleEuropeWest1, - } - encodingResp, err := encodingS.Create(encoding) - errorHandler(encodingResp.Status, err) - - h264S := services.NewH264CodecConfigurationService(bitmovin) - video1080pConfig := &models.H264CodecConfiguration{ - Name: stringToPtr("example_video_codec_configuration_1080p"), - Bitrate: intToPtr(4800000), - FrameRate: floatToPtr(25.0), - Width: intToPtr(1920), - Height: intToPtr(1080), - Profile: bitmovintypes.H264ProfileHigh, - } - video720Config := &models.H264CodecConfiguration{ - Name: stringToPtr("example_video_codec_configuration_720p"), - Bitrate: intToPtr(2400000), - FrameRate: floatToPtr(25.0), - Width: intToPtr(1280), - Height: intToPtr(720), - Profile: bitmovintypes.H264ProfileHigh, - } - video1080pResp, err := h264S.Create(video1080pConfig) - errorHandler(video1080pResp.Status, err) - video720Resp, err := h264S.Create(video720Config) - errorHandler(video720Resp.Status, err) - - aacS := services.NewAACCodecConfigurationService(bitmovin) - aacConfig := &models.AACCodecConfiguration{ - Name: stringToPtr("example_audio_codec_configuration"), - Bitrate: intToPtr(128000), - SamplingRate: floatToPtr(48000.0), - } - aacResp, err := aacS.Create(aacConfig) - errorHandler(aacResp.Status, err) - - videoInputStream := models.InputStream{ - InputID: httpResp.Data.Result.ID, - InputPath: stringToPtr("YOUR INPUT FILE PATH AND LOCATION"), - SelectionMode: bitmovintypes.SelectionModeAuto, - } - audioInputStream := models.InputStream{ - InputID: httpResp.Data.Result.ID, - InputPath: stringToPtr("YOUR INPUT FILE PATH AND LOCATION"), - SelectionMode: bitmovintypes.SelectionModeAuto, - } - - vis := []models.InputStream{videoInputStream} - videoStream1080p := &models.Stream{ - CodecConfigurationID: video1080pResp.Data.Result.ID, - InputStreams: vis, - } - videoStream720p := &models.Stream{ - CodecConfigurationID: video720Resp.Data.Result.ID, - InputStreams: vis, - } - - videoStream1080pResp, err := encodingS.AddStream(*encodingResp.Data.Result.ID, videoStream1080p) - errorHandler(videoStream1080pResp.Status, err) - videoStream720pResp, err := encodingS.AddStream(*encodingResp.Data.Result.ID, videoStream720p) - errorHandler(videoStream720pResp.Status, err) - - ais := []models.InputStream{audioInputStream} - audioStream := &models.Stream{ - CodecConfigurationID: aacResp.Data.Result.ID, - InputStreams: ais, - } - aacStreamResp, err := encodingS.AddStream(*encodingResp.Data.Result.ID, audioStream) - errorHandler(aacStreamResp.Status, err) - - aclEntry := models.ACLItem{ - Permission: bitmovintypes.ACLPermissionPublicRead, - } - acl := []models.ACLItem{aclEntry} - - videoMuxingStream1080p := models.StreamItem{ - StreamID: videoStream1080pResp.Data.Result.ID, - } - videoMuxingStream720p := models.StreamItem{ - StreamID: videoStream720pResp.Data.Result.ID, - } - audioMuxingStream := models.StreamItem{ - StreamID: aacStreamResp.Data.Result.ID, - } - - videoMuxing1080pOutput := models.Output{ - OutputID: s3OutputResp.Data.Result.ID, - OutputPath: stringToPtr("golang_test/video/1080p"), - ACL: acl, - } - videoMuxing720pOutput := models.Output{ - OutputID: s3OutputResp.Data.Result.ID, - OutputPath: stringToPtr("golang_test/video/720p"), - ACL: acl, - } - audioMuxingOutput := models.Output{ - OutputID: s3OutputResp.Data.Result.ID, - OutputPath: stringToPtr("golang_test/audio"), - ACL: acl, - } - - videoMuxing1080p := &models.FMP4Muxing{ - SegmentLength: floatToPtr(4.0), - SegmentNaming: stringToPtr("seg_%number%.m4s"), - InitSegmentName: stringToPtr("init.mp4"), - Streams: []models.StreamItem{videoMuxingStream1080p}, - Outputs: []models.Output{videoMuxing1080pOutput}, - } - videoMuxing1080pResp, err := encodingS.AddFMP4Muxing(*encodingResp.Data.Result.ID, videoMuxing1080p) - errorHandler(videoMuxing1080pResp.Status, err) - - videoMuxing720p := &models.FMP4Muxing{ - SegmentLength: floatToPtr(4.0), - SegmentNaming: stringToPtr("seg_%number%.m4s"), - InitSegmentName: stringToPtr("init.mp4"), - Streams: []models.StreamItem{videoMuxingStream720p}, - Outputs: []models.Output{videoMuxing720pOutput}, - } - videoMuxing720pResp, err := encodingS.AddFMP4Muxing(*encodingResp.Data.Result.ID, videoMuxing720p) - errorHandler(videoMuxing720pResp.Status, err) - - audioMuxing := &models.FMP4Muxing{ - SegmentLength: floatToPtr(4.0), - SegmentNaming: stringToPtr("seg_%number%.m4s"), - InitSegmentName: stringToPtr("init.mp4"), - Streams: []models.StreamItem{audioMuxingStream}, - Outputs: []models.Output{audioMuxingOutput}, - } - audioMuxingResp, err := encodingS.AddFMP4Muxing(*encodingResp.Data.Result.ID, audioMuxing) - errorHandler(audioMuxingResp.Status, err) - - startResp, err := encodingS.Start(*encodingResp.Data.Result.ID) - errorHandler(startResp.Status, err) - - var status string - status = "" - for status != "FINISHED" { - time.Sleep(10 * time.Second) - statusResp, err := encodingS.RetrieveStatus(*encodingResp.Data.Result.ID) - if err != nil { - fmt.Println("error in Encoding Status") - fmt.Println(err) - return - } - // Polling and Printing out the response - fmt.Printf("%+v\n", statusResp) - status = *statusResp.Data.Result.Status - if status == "ERROR" { - fmt.Println("error in Encoding Status") - fmt.Printf("%+v\n", statusResp) - return - } - } - - manifestOutput := models.Output{ - OutputID: s3OutputResp.Data.Result.ID, - OutputPath: stringToPtr("golang_test/manifest"), - ACL: acl, - } - dashManifest := &models.DashManifest{ - ManifestName: stringToPtr("your_manifest_name.mpd"), - Outputs: []models.Output{manifestOutput}, - } - dashService := services.NewDashManifestService(bitmovin) - dashManifestResp, err := dashService.Create(dashManifest) - errorHandler(dashManifestResp.Status, err) - - period := &models.Period{} - periodResp, err := dashService.AddPeriod(*dashManifestResp.Data.Result.ID, period) - errorHandler(periodResp.Status, err) - - vas := &models.VideoAdaptationSet{} - vasResp, err := dashService.AddVideoAdaptationSet(*dashManifestResp.Data.Result.ID, *periodResp.Data.Result.ID, vas) - errorHandler(vasResp.Status, err) - - aas := &models.AudioAdaptationSet{ - Language: stringToPtr("en"), - } - aasResp, err := dashService.AddAudioAdaptationSet(*dashManifestResp.Data.Result.ID, *periodResp.Data.Result.ID, aas) - errorHandler(aasResp.Status, err) - - fmp4Rep1080 := &models.FMP4Representation{ - Type: bitmovintypes.FMP4RepresentationTypeTemplate, - MuxingID: videoMuxing1080pResp.Data.Result.ID, - EncodingID: encodingResp.Data.Result.ID, - SegmentPath: stringToPtr("../video/1080p"), - } - fmp4Rep1080Resp, err := dashService.AddFMP4Representation(*dashManifestResp.Data.Result.ID, *periodResp.Data.Result.ID, *vasResp.Data.Result.ID, fmp4Rep1080) - errorHandler(fmp4Rep1080Resp.Status, err) - - fmp4Rep720 := &models.FMP4Representation{ - Type: bitmovintypes.FMP4RepresentationTypeTemplate, - MuxingID: videoMuxing720pResp.Data.Result.ID, - EncodingID: encodingResp.Data.Result.ID, - SegmentPath: stringToPtr("../video/720p"), - } - fmp4Rep720Resp, err := dashService.AddFMP4Representation(*dashManifestResp.Data.Result.ID, *periodResp.Data.Result.ID, *vasResp.Data.Result.ID, fmp4Rep720) - errorHandler(fmp4Rep720Resp.Status, err) - - fmp4RepAudio := &models.FMP4Representation{ - Type: bitmovintypes.FMP4RepresentationTypeTemplate, - MuxingID: audioMuxingResp.Data.Result.ID, - EncodingID: encodingResp.Data.Result.ID, - SegmentPath: stringToPtr("../audio"), - } - fmp4RepAudioResp, err := dashService.AddFMP4Representation(*dashManifestResp.Data.Result.ID, *periodResp.Data.Result.ID, *aasResp.Data.Result.ID, fmp4RepAudio) - errorHandler(fmp4RepAudioResp.Status, err) - - startResp, err = dashService.Start(*dashManifestResp.Data.Result.ID) - errorHandler(startResp.Status, err) - - status = "" - for status != "FINISHED" { - time.Sleep(5 * time.Second) - statusResp, err := dashService.RetrieveStatus(*dashManifestResp.Data.Result.ID) - if err != nil { - fmt.Println("error in Manifest Status") - fmt.Println(err) - return - } - // Polling and Printing out the response - fmt.Printf("%+v\n", statusResp) - status = *statusResp.Data.Result.Status - if status == "ERROR" { - fmt.Println("error in Manifest Status") - fmt.Printf("%+v\n", statusResp) - return - } - } - - // Delete Encoding - deleteResp, err := encodingS.Delete(*encodingResp.Data.Result.ID) - errorHandler(deleteResp.Status, err) -} - -func errorHandler(responseStatus bitmovintypes.ResponseStatus, err error) { - if err != nil { - fmt.Println("go error") - fmt.Println(err) - } else if responseStatus == "ERROR" { - fmt.Println("api error") - } -} - -func stringToPtr(s string) *string { - return &s -} - -func intToPtr(i int64) *int64 { - return &i -} - -func boolToPtr(b bool) *bool { - return &b -} - -func floatToPtr(f float64) *float64 { - return &f -} - -``` - -For more examples go to our [example page](https://github.com/bitmovin/bitmovin-go/tree/master/examples/). - -Contributing ------------- - -bitmovin-go is licensed under the MIT license. If you want to contribute feel free to send Pull-Requests. diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovin/bitmovin.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovin/bitmovin.go deleted file mode 100644 index 36909f79..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovin/bitmovin.go +++ /dev/null @@ -1,30 +0,0 @@ -package bitmovin - -import ( - "net/http" - "time" -) - -type Bitmovin struct { - HTTPClient *http.Client - APIKey *string - APIBaseURL *string -} - -func NewBitmovinDefaultTimeout(apiKey string, baseURL string) *Bitmovin { - return NewBitmovin(apiKey, baseURL, 5) -} - -func NewBitmovinDefault(apiKey string) *Bitmovin { - return NewBitmovinDefaultTimeout(apiKey, `https://api.bitmovin.com/v1/`) -} - -func NewBitmovin(apiKey string, baseURL string, timeout int64) *Bitmovin { - return &Bitmovin{ - HTTPClient: &http.Client{ - Timeout: time.Second * time.Duration(timeout), - }, - APIKey: &apiKey, - APIBaseURL: &baseURL, - } -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/aac_channel_layout.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/aac_channel_layout.go deleted file mode 100644 index 23fb2d23..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/aac_channel_layout.go +++ /dev/null @@ -1,34 +0,0 @@ -package bitmovintypes - -type AACChannelLayout string - -// Constants in Golang are not supposed to be all CAPS -const ( - AACChannelLayoutNone AACChannelLayout = "NONE" - AACChannelLayoutMono AACChannelLayout = "MONO" - AACChannelLayoutStereo AACChannelLayout = "STEREO" - AACChannelLayoutSurround AACChannelLayout = "SURROUND" - AACChannelLayoutQuad AACChannelLayout = "QUAD" - AACChannelLayoutHexagonal AACChannelLayout = "HEXAGONAL" - AACChannelLayoutOctogonal AACChannelLayout = "OCTOGONAL" - AACChannelLayoutStereoDownmix AACChannelLayout = "STEREO_DOWNMIX" - AACChannelLayout21 AACChannelLayout = "2.1" - AACChannelLayout22 AACChannelLayout = "2.2" - AACChannelLayout31 AACChannelLayout = "3.1" - AACChannelLayout40 AACChannelLayout = "4.0" - AACChannelLayout41 AACChannelLayout = "4.1" - AACChannelLayout50 AACChannelLayout = "5.0" - AACChannelLayout50Back AACChannelLayout = "5.0_BACK" - AACChannelLayout51 AACChannelLayout = "5.1" - AACChannelLayout51Back AACChannelLayout = "5.1_BACK" - AACChannelLayout60 AACChannelLayout = "6.0" - AACChannelLayout60Front AACChannelLayout = "6.0_FRONT" - AACChannelLayout61 AACChannelLayout = "6.1" - AACChannelLayout61Back AACChannelLayout = "6.1_BACK" - AACChannelLayout61Front AACChannelLayout = "6.1_FRONT" - AACChannelLayout70 AACChannelLayout = "7.0" - AACChannelLayout70Front AACChannelLayout = "7.0_FRONT" - AACChannelLayout71 AACChannelLayout = "7.1" - AACChannelLayout70Wide AACChannelLayout = "7.0_WIDE" - AACChannelLayout70WideBack AACChannelLayout = "7.0_WIDE_BACK" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/acl_permission.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/acl_permission.go deleted file mode 100644 index 600d77d6..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/acl_permission.go +++ /dev/null @@ -1,8 +0,0 @@ -package bitmovintypes - -type ACLPermission string - -const ( - ACLPermissionPublicRead ACLPermission = "PUBLIC_READ" - ACLPermissionPrivate ACLPermission = "PRIVATE" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/aws_cloud_region.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/aws_cloud_region.go deleted file mode 100644 index 6717888c..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/aws_cloud_region.go +++ /dev/null @@ -1,17 +0,0 @@ -package bitmovintypes - -type AWSCloudRegion string - -const ( - AWSCloudRegionUSEast1 AWSCloudRegion = "US_EAST_1" - AWSCloudRegionUSWest1 AWSCloudRegion = "US_WEST_1" - AWSCloudRegionUSWest2 AWSCloudRegion = "US_WEST_2" - AWSCloudRegionEUWest1 AWSCloudRegion = "EU_WEST_1" - AWSCloudRegionEUCentral1 AWSCloudRegion = "EU_CENTRAL_1" - AWSCloudRegionAPSouth1 AWSCloudRegion = "AP_SOUTH_1" - AWSCloudRegionAPNortheast1 AWSCloudRegion = "AP_NORTHEAST_1" - AWSCloudRegionAPNortheast2 AWSCloudRegion = "AP_NORTHEAST_2" - AWSCloudRegionAPSoutheast1 AWSCloudRegion = "AP_SOUTHEAST_1" - AWSCloudRegionAPSoutheast2 AWSCloudRegion = "AP_SOUTHEAST_2" - AWSCloudRegionSAEast1 AWSCloudRegion = "SA_EAST_1" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/b_adapt.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/b_adapt.go deleted file mode 100644 index 68273936..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/b_adapt.go +++ /dev/null @@ -1,9 +0,0 @@ -package bitmovintypes - -type BAdapt string - -const ( - BAdaptNone BAdapt = "NONE" - BAdaptFast BAdapt = "FAST" - BAdaptFull BAdapt = "FULL" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/cloud_region.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/cloud_region.go deleted file mode 100644 index 17bfca3d..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/cloud_region.go +++ /dev/null @@ -1,22 +0,0 @@ -package bitmovintypes - -type CloudRegion string - -const ( - CloudRegionAWSUSEast1 CloudRegion = "AWS_US_EAST_1" - CloudRegionAWSUSWest1 CloudRegion = "AWS_US_WEST_1" - CloudRegionAWSUSWest2 CloudRegion = "AWS_US_WEST_2" - CloudRegionAWSEUWest1 CloudRegion = "AWS_EU_WEST_1" - CloudRegionAWSEUCentral1 CloudRegion = "AWS_EU_CENTRAL_1" - CloudRegionAWSAPSouth1 CloudRegion = "AWS_AP_SOUTH_1" - CloudRegionAWSAPNortheast1 CloudRegion = "AWS_AP_NORTHEAST_1" - CloudRegionAWSAPNortheast2 CloudRegion = "AWS_AP_NORTHEAST_2" - CloudRegionAWSAPSoutheast1 CloudRegion = "AWS_AP_SOUTHEAST_1" - CloudRegionAWSAPSoutheast2 CloudRegion = "AWS_AP_SOUTHEAST_2" - CloudRegionAWSSAEast1 CloudRegion = "AWS_SA_EAST_1" - CloudRegionGoogleEuropeWest1 CloudRegion = "GOOGLE_EUROPE_WEST_1" - CloudRegionGoogleUSEast1 CloudRegion = "GOOGLE_US_EAST_1" - CloudRegionGoogleUSCentral1 CloudRegion = "GOOGLE_US_CENTRAL_1" - CloudRegionGoogleAsiaEast1 CloudRegion = "GOOGLE_ASIA_EAST_1" - CloudRegionExternal CloudRegion = "EXTERNAL" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/deinterlacing_mode.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/deinterlacing_mode.go deleted file mode 100644 index c26b4c0b..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/deinterlacing_mode.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type DeinterlacingMode string - -const ( - DeinterlacingModeFrame DeinterlacingMode = "FRAME" - DeinterlacingModeField DeinterlacingMode = "FIELD" - DeinterlacingModeFrameNoSpatial DeinterlacingMode = "FRAME_NOSPATIAL" - DeinterlacingModeFieldNoSpatial DeinterlacingMode = "FIELD_NOSPATIAL" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/encoder_version.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/encoder_version.go deleted file mode 100644 index 47758fcf..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/encoder_version.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type EncoderVersion string - -const ( - EncoderVersionStable EncoderVersion = "STABLE" - EncoderVersionBeta EncoderVersion = "BETA" - EncoderVersion_0_16_0 EncoderVersion = "0.16.0" - EncoderVersion_0_17_0 EncoderVersion = "0.17.0" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/encryption_method.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/encryption_method.go deleted file mode 100644 index eb048886..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/encryption_method.go +++ /dev/null @@ -1,8 +0,0 @@ -package bitmovintypes - -type EncryptionMethod string - -const ( - EncryptionMethodMpegCenc EncryptionMethod = "MPEG_CENC" - EncryptionMethodPiffCtr EncryptionMethod = "PIFF_CTR" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/fmp4_representation_type.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/fmp4_representation_type.go deleted file mode 100644 index fe275b5a..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/fmp4_representation_type.go +++ /dev/null @@ -1,9 +0,0 @@ -package bitmovintypes - -type FMP4RepresentationType string - -const ( - FMP4RepresentationTypeTemplate FMP4RepresentationType = "TEMPLATE" - FMP4RepresentationTypeList FMP4RepresentationType = "LIST" - FMP4RepresentationTypeTimeline FMP4RepresentationType = "TIMELINE" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/google_cloud_region.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/google_cloud_region.go deleted file mode 100644 index ef4a73fa..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/google_cloud_region.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type GoogleCloudRegion string - -const ( - GoogleCloudRegionEuropeWest1 GoogleCloudRegion = "EUROPE_WEST_1" - GoogleCloudRegionUSEast1 GoogleCloudRegion = "US_EAST_1" - GoogleCloudRegionUSCentral1 GoogleCloudRegion = "US_CENTRAL_1" - GoogleCloudRegionAsiaEast1 GoogleCloudRegion = "ASIA_EAST_1" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h264_level.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h264_level.go deleted file mode 100644 index dd4a9bb3..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h264_level.go +++ /dev/null @@ -1,23 +0,0 @@ -package bitmovintypes - -type H264Level string - -const ( - H264Level1 H264Level = "1" - H264Level1b H264Level = "1b" - H264Level1_1 H264Level = "1.1" - H264Level1_2 H264Level = "1.2" - H264Level1_3 H264Level = "1.3" - H264Level2 H264Level = "2" - H264Level2_1 H264Level = "2.1" - H264Level2_2 H264Level = "2.2" - H264Level3 H264Level = "3" - H264Level3_1 H264Level = "3.1" - H264Level3_2 H264Level = "3.2" - H264Level4 H264Level = "4" - H264Level4_1 H264Level = "4.1" - H264Level4_2 H264Level = "4.2" - H264Level5 H264Level = "5" - H264Level5_1 H264Level = "5.1" - H264Level5_2 H264Level = "5.2" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h264_profile.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h264_profile.go deleted file mode 100644 index 3f55d004..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h264_profile.go +++ /dev/null @@ -1,9 +0,0 @@ -package bitmovintypes - -type H264Profile string - -const ( - H264ProfileBaseline H264Profile = "BASELINE" - H264ProfileMain H264Profile = "MAIN" - H264ProfileHigh H264Profile = "HIGH" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h265_level.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h265_level.go deleted file mode 100644 index 84ff9c7e..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h265_level.go +++ /dev/null @@ -1,19 +0,0 @@ -package bitmovintypes - -type H265Level string - -const ( - H265Level1 H265Level = "1" - H265Level2 H265Level = "2" - H265Level2_1 H265Level = "2.1" - H265Level3 H265Level = "3" - H265Level3_1 H265Level = "3.1" - H265Level4 H265Level = "4" - H265Level4_1 H265Level = "4.1" - H265Level5 H265Level = "5" - H265Level5_1 H265Level = "5.1" - H265Level5_2 H265Level = "5.2" - H265Level6 H265Level = "6" - H265Level6_1 H265Level = "6.1" - H265Level6_2 H265Level = "6.2" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h265_profile.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h265_profile.go deleted file mode 100644 index eb63360e..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/h265_profile.go +++ /dev/null @@ -1,8 +0,0 @@ -package bitmovintypes - -type H265Profile string - -const ( - H265ProfileMain H265Profile = "main" - H265ProfileMain10 H265Profile = "main10" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/max_ctu_size.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/max_ctu_size.go deleted file mode 100644 index f4231eeb..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/max_ctu_size.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -// FIXME: This could be canonically an int -type MaxCTUSize string - -const ( - MaxCTUSize16 MaxCTUSize = "16" - MaxCTUSize32 MaxCTUSize = "32" - MaxCTUSize64 MaxCTUSize = "64" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/media_type.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/media_type.go deleted file mode 100644 index 246f9004..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/media_type.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type MediaType string - -const ( - MediaTypeAudio MediaType = "AUDIO" - MediaTypeVideo MediaType = "VIDEO" - MediaTypeSubtitles MediaType = "SUBTITLES" - MediaTypeClosedCaptions MediaType = "CLOSED_CAPTIONS" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/message_type.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/message_type.go deleted file mode 100644 index 94ee0558..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/message_type.go +++ /dev/null @@ -1,8 +0,0 @@ -package bitmovintypes - -type MessageType string - -const ( - MessageTypeInfo MessageType = "INFO" - MessageTypeError MessageType = "ERROR" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/motion_search.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/motion_search.go deleted file mode 100644 index d0e5f62c..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/motion_search.go +++ /dev/null @@ -1,11 +0,0 @@ -package bitmovintypes - -type MotionSearch string - -const ( - MotionSearchDiamond MotionSearch = "DIA" - MotionSearchHexagon MotionSearch = "HEX" - MotionSearchUnevenMultiHexagon MotionSearch = "UMH" - MotionSearchStar MotionSearch = "STAR" - MotionSearchFull MotionSearch = "FULL" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/mv_prediction_mode.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/mv_prediction_mode.go deleted file mode 100644 index 0c9cc0a2..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/mv_prediction_mode.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type MVPredictionMode string - -const ( - MVPredictionModeNone MVPredictionMode = "NONE" - MVPredictionModeSpatial MVPredictionMode = "SPATIAL" - MVPredictionModeTemporal MVPredictionMode = "TEMPORAL" - MVPredictionModeAuto MVPredictionMode = "AUTO" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/partitions.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/partitions.go deleted file mode 100644 index f11c626a..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/partitions.go +++ /dev/null @@ -1,13 +0,0 @@ -package bitmovintypes - -type Partition string - -const ( - PartitionNone = `NONE` - PartitionP8X8 = `P8X8` - PartitionP4X4 = `P4X4` - PartitionB8X8 = `B8X8` - PartitionI8X8 = `I8X8` - PartitionI4X4 = `I4X4` - PartitionALL = `ALL` -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/picture_field_parity.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/picture_field_parity.go deleted file mode 100644 index 37e2edfb..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/picture_field_parity.go +++ /dev/null @@ -1,9 +0,0 @@ -package bitmovintypes - -type PictureFieldParity string - -const ( - PictureFieldParityAuto PictureFieldParity = "AUTO" - PictureFieldParityTopFieldFirst PictureFieldParity = "TOP_FIELD_FIRST" - PictureFieldParityBottomFieldFirst PictureFieldParity = "BOTTOM_FIELD_FIRST" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/position_unit.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/position_unit.go deleted file mode 100644 index 3da10b6d..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/position_unit.go +++ /dev/null @@ -1,8 +0,0 @@ -package bitmovintypes - -type PositionUnit string - -const ( - PositionSeconds PositionUnit = "SECONDS" - PositionPercents PositionUnit = "PERCENTS" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/response_status.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/response_status.go deleted file mode 100644 index ac57600f..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/response_status.go +++ /dev/null @@ -1,8 +0,0 @@ -package bitmovintypes - -type ResponseStatus string - -const ( - ResponseStatusSuccess ResponseStatus = "SUCCESS" - ResponseStatusError ResponseStatus = "ERROR" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/selection_mode.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/selection_mode.go deleted file mode 100644 index ec366998..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/selection_mode.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type SelectionMode string - -const ( - SelectionModeAuto SelectionMode = "AUTO" - SelectionModePositionAbsolute SelectionMode = "POSITION_ABSOLUTE" - SelectionModeVideoRelative SelectionMode = "VIDEO_RELATIVE" - SelectionModeAudioRelative SelectionMode = "AUDIO_RELATIVE" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/status.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/status.go deleted file mode 100644 index 2ef840d7..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/status.go +++ /dev/null @@ -1,11 +0,0 @@ -package bitmovintypes - -type Status string - -const ( - StatusCreated Status = "CREATED" - StatusQueued Status = "QUEUED" - StatusRunning Status = "RUNNING" - StatusFinished Status = "FINISHED" - StatusError Status = "ERROR" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/stream_conditions.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/stream_conditions.go deleted file mode 100644 index 9ed4a195..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/stream_conditions.go +++ /dev/null @@ -1,20 +0,0 @@ -package bitmovintypes - -type ConditionAttribute string - -const ( - ConditionAttributeHeight ConditionAttribute = "HEIGHT" - ConditionAttributeWidth ConditionAttribute = "WIDTH" - ConditionAttributeFPS ConditionAttribute = "FPS" - ConditionAttributeBitrate ConditionAttribute = "BITRATE" - ConditionAttributeAspectRatio ConditionAttribute = "ASPECTRATIO" - ConditionAttributeInputStream ConditionAttribute = "INPUTSTREAM" -) - -type ConditionType string - -const ( - ConditionTypeAnd ConditionType = "AND" - ConditionTypeOr ConditionType = "OR" - ConditionTypeCondition ConditionType = "CONDITION" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/trellis.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/trellis.go deleted file mode 100644 index 4eddf5d8..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/trellis.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type Trellis string - -const ( - TrellisDisabled = `DISABLED` - TrellisEnabledFinalMB = `ENABLED_FINAL_MB` - TrellisEnabledAll = `ENABLED_ALL` - TrellisDefault = TrellisEnabledFinalMB -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/tu_inter_depth.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/tu_inter_depth.go deleted file mode 100644 index 0fd2aee4..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/tu_inter_depth.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type TUInterDepth string - -const ( - TUInterDepth1 TUInterDepth = "1" - TUInterDepth2 TUInterDepth = "2" - TUInterDepth3 TUInterDepth = "3" - TUInterDepth4 TUInterDepth = "4" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/tu_intra_depth.go b/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/tu_intra_depth.go deleted file mode 100644 index 2970ec46..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/bitmovintypes/tu_intra_depth.go +++ /dev/null @@ -1,10 +0,0 @@ -package bitmovintypes - -type TUIntraDepth string - -const ( - TUIntraDepth1 TUIntraDepth = "1" - TUIntraDepth2 TUIntraDepth = "2" - TUIntraDepth3 TUIntraDepth = "3" - TUIntraDepth4 TUIntraDepth = "4" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/codec_config_builder.go b/vendor/github.com/bitmovin/bitmovin-go/models/codec_config_builder.go deleted file mode 100644 index 539fc904..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/codec_config_builder.go +++ /dev/null @@ -1,71 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type H264CodecConfigBuilder struct { - Config *H264CodecConfiguration -} - -func NewH264CodecConfigBuilder(name string) *H264CodecConfigBuilder { - return &H264CodecConfigBuilder{ - Config: &H264CodecConfiguration{ - Name: &name, - }, - } -} - -func (b *H264CodecConfigBuilder) Width(w int64) *H264CodecConfigBuilder { - b.Config.Width = &w - return b -} -func (b *H264CodecConfigBuilder) Height(h int64) *H264CodecConfigBuilder { - b.Config.Height = &h - return b -} -func (b *H264CodecConfigBuilder) Bitrate(br int64) *H264CodecConfigBuilder { - b.Config.Bitrate = &br - return b -} -func (b *H264CodecConfigBuilder) Framerate(f float64) *H264CodecConfigBuilder { - b.Config.FrameRate = &f - return b -} -func (b *H264CodecConfigBuilder) Profile(p bitmovintypes.H264Profile) *H264CodecConfigBuilder { - b.Config.Profile = p - return b -} -func (b *H264CodecConfigBuilder) BFrames(bf int64) *H264CodecConfigBuilder { - b.Config.BFrames = &bf - return b -} -func (b *H264CodecConfigBuilder) RefFrames(r int64) *H264CodecConfigBuilder { - b.Config.RefFrames = &r - return b -} -func (b *H264CodecConfigBuilder) MVPredictionMode(m bitmovintypes.MVPredictionMode) *H264CodecConfigBuilder { - b.Config.MVPredictionMode = m - return b -} -func (b *H264CodecConfigBuilder) MVSearchRangeMax(r int64) *H264CodecConfigBuilder { - b.Config.MVSearchRangeMax = &r - return b -} -func (b *H264CodecConfigBuilder) CABAC(r bool) *H264CodecConfigBuilder { - b.Config.CABAC = &r - return b -} -func (b *H264CodecConfigBuilder) Trellis(r bitmovintypes.Trellis) *H264CodecConfigBuilder { - b.Config.Trellis = r - return b -} -func (b *H264CodecConfigBuilder) RcLookahead(r int64) *H264CodecConfigBuilder { - b.Config.RcLookahead = &r - return b -} -func (b *H264CodecConfigBuilder) Partitions(r []bitmovintypes.Partition) *H264CodecConfigBuilder { - b.Config.Partitions = r - return b -} -func (b *H264CodecConfigBuilder) Build() *H264CodecConfiguration { - return b.Config -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/codec_configurations.go b/vendor/github.com/bitmovin/bitmovin-go/models/codec_configurations.go deleted file mode 100644 index 61ea510f..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/codec_configurations.go +++ /dev/null @@ -1,208 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type CodecConfigurationItem struct { - ID *string `json:"id,omitempty"` - // TODO: Codec typing - Type *string `json:"type,omitempty"` -} - -type CodecConfigurationListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []CodecConfigurationItem `json:"items,omitempty"` -} - -type CodecConfigurationListData struct { - Result CodecConfigurationListResult `json:"result,omitempty"` -} - -type CodecConfigurationListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data CodecConfigurationListData `json:"data,omitempty"` -} - -type AACCodecConfiguration struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Bitrate *int64 `json:"bitrate,omitempty"` - SamplingRate *float64 `json:"rate,omitempty"` - ChannelLayout bitmovintypes.AACChannelLayout `json:"channelLayout,omitempty"` - VolumeAdjust *int64 `json:"volumeAdjust,omitempty"` - Normalize *bool `json:"normalize,omitempty"` -} - -type AACCodecConfigurationData struct { - //Success fields - Result AACCodecConfiguration `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - // TODO: type all the error codes similarly to the http status codes in golang - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type AACCodecConfigurationResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data AACCodecConfigurationData `json:"data,omitempty"` -} - -type AACCodecConfigurationListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []AACCodecConfiguration `json:"items,omitempty"` -} - -type AACCodecConfigurationListData struct { - Result AACCodecConfigurationListResult `json:"result,omitempty"` -} - -type AACCodecConfigurationListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data AACCodecConfigurationListData `json:"data,omitempty"` -} - -type H264CodecConfiguration struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Bitrate *int64 `json:"bitrate,omitempty"` - FrameRate *float64 `json:"rate,omitempty"` - Width *int64 `json:"width,omitempty"` - Height *int64 `json:"height,omitempty"` - Profile bitmovintypes.H264Profile `json:"profile,omitempty"` - BFrames *int64 `json:"bFrames,omitempty"` - RefFrames *int64 `json:"refFrames,omitempty"` - QPMin *int64 `json:"qpMin,omitempty"` - QPMax *int64 `json:"qpMax,omitempty"` - MVPredictionMode bitmovintypes.MVPredictionMode `json:"mvPredictionMode,omitempty"` - MVSearchRangeMax *int64 `json:"mvSearchRangeMax,omitempty"` - CABAC *bool `json:"cabac,omitempty"` - MaxBitrate *int64 `json:"maxBitrate,omitempty"` - MinBitrate *int64 `json:"minBitrate,omitempty"` - BufSize *int64 `json:"bufsize,omitempty"` - MinGOP *int64 `json:"minGop,omitempty"` - MaxGOP *int64 `json:"maxGop,omitempty"` - Level bitmovintypes.H264Level `json:"level,omitempty"` - Trellis bitmovintypes.Trellis `json:"trellis,omitempty"` - RcLookahead *int64 `json:"rcLookahead,omitempty"` - Partitions []bitmovintypes.Partition `json:"partitions,omitempty"` - CRF *float64 `json:"crf,omitempty"` -} - -type H264CodecConfigurationData struct { - //Success fields - Result H264CodecConfiguration `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type H264CodecConfigurationResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data H264CodecConfigurationData `json:"data,omitempty"` -} - -type H264CodecConfigurationListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []H264CodecConfiguration `json:"items,omitempty"` -} - -type H264CodecConfigurationListData struct { - Result H264CodecConfigurationListResult `json:"result,omitempty"` -} - -type H264CodecConfigurationListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data H264CodecConfigurationListData `json:"data,omitempty"` -} - -type H265CodecConfiguration struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Bitrate *int64 `json:"bitrate,omitempty"` - FrameRate *float64 `json:"rate,omitempty"` - Width *int64 `json:"width,omitempty"` - Height *int64 `json:"height,omitempty"` - Profile bitmovintypes.H265Profile `json:"profile,omitempty"` - BFrames *int64 `json:"bFrames,omitempty"` - RefFrames *int64 `json:"refFrames,omitempty"` - QP *int64 `json:"qp,omitempty"` - MaxBitrate *int64 `json:"maxBitrate,omitempty"` - MinBitrate *int64 `json:"minBitrate,omitempty"` - BufSize *int64 `json:"bufsize,omitempty"` - MinGOP *int64 `json:"minGop,omitempty"` - MaxGOP *int64 `json:"maxGop,omitempty"` - Level bitmovintypes.H265Level `json:"level,omitempty"` - RCLookahead *int64 `json:"rcLookahead,omitempty"` - BAdapt bitmovintypes.BAdapt `json:"bAdapt,omitempty"` - MaxCTUSize bitmovintypes.MaxCTUSize `json:"maxCTUSize,omitempty"` - TUIntraDepth bitmovintypes.TUIntraDepth `json:"tuIntraDepth,omitempty"` - TUInterDepth bitmovintypes.TUInterDepth `json:"tuInterDepth,omitempty"` - MotionSearch bitmovintypes.MotionSearch `json:"motionSearch,omitempty"` - SubMe *int64 `json:"subMe,omitempty"` - MotionSearchRange *int64 `json:"motionSearchRange,omitempty"` - WeightPredictionOnPSlice *bool `json:"weightPredictionOnPSlice,omitempty"` - WeightPredictionOnBSlice *bool `json:"weightPredictionOnBSlice,omitempty"` - SAO *bool `json:"sao,omitempty"` -} - -type H265CodecConfigurationData struct { - //Success fields - Result H265CodecConfiguration `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type H265CodecConfigurationResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data H265CodecConfigurationData `json:"data,omitempty"` -} - -type H265CodecConfigurationListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []H265CodecConfiguration `json:"items,omitempty"` -} - -type H265CodecConfigurationListData struct { - Result H265CodecConfigurationListResult `json:"result,omitempty"` -} - -type H265CodecConfigurationListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data H265CodecConfigurationListData `json:"data,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/custom_data_response.go b/vendor/github.com/bitmovin/bitmovin-go/models/custom_data_response.go deleted file mode 100644 index 6f0062a5..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/custom_data_response.go +++ /dev/null @@ -1,19 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type Data struct { - Result Result `json:"result"` -} - -type Result struct { - CreatedAt *string `json:"createdAt"` - ModifiedAt *string `json:"modifiedAt"` - CustomData map[string]interface{} `json:"customData"` -} - -type CustomDataResponse struct { - RequestID *string `json:"requestId"` - Status bitmovintypes.ResponseStatus `json:"status"` - Data Data `json:"data"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/dash.go b/vendor/github.com/bitmovin/bitmovin-go/models/dash.go deleted file mode 100644 index c9a9b5ed..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/dash.go +++ /dev/null @@ -1,198 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type DashManifest struct { - ID *string `json:"id"` - Name *string `json:"name"` - Description *string `json:"description"` - Outputs []Output `json:"outputs"` - ManifestName *string `json:"manifestName"` -} - -type DashManifestData struct { - //Success fields - Result DashManifest `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type DashManifestResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data DashManifestData `json:"data,omitempty"` -} - -type LiveDashManifest struct { - ManifestID *string `json:"manifestId,omitempty"` - TimeShift *float64 `json:"timeShift,omitempty"` - LiveEdgeOffset *float64 `json:"liveEdgeOffset,omitempty"` -} - -type Period struct { - ID *string `json:"id"` - Start *float64 `json:"start"` - Duration *float64 `json:"duration"` -} - -type PeriodData struct { - //Success fields - Result Period `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type PeriodResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data PeriodData `json:"data,omitempty"` -} - -type CustomAttribute struct { - Key *string `json:"key,omitempty"` - Value *string `json:"value,omitempty"` -} - -type AudioAdaptationSet struct { - ID *string `json:"id,omitempty"` - CustomAttributes []CustomAttribute `json:"customAttributes,omitempty"` - Language *string `json:"lang,omitempty"` -} - -type AudioAdaptationSetData struct { - //Success fields - Result AudioAdaptationSet `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type AudioAdaptationSetResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data AudioAdaptationSetData `json:"data,omitempty"` -} - -type VideoAdaptationSet struct { - ID *string `json:"id,omitempty"` - CustomAttributes []CustomAttribute `json:"customAttributes,omitempty"` -} - -type VideoAdaptationSetData struct { - //Success fields - Result AudioAdaptationSet `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type VideoAdaptationSetResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data VideoAdaptationSetData `json:"data,omitempty"` -} - -type FMP4Representation struct { - ID *string `json:"id,omitempty"` - Type bitmovintypes.FMP4RepresentationType `json:"type,omitempty"` - MuxingID *string `json:"muxingId,omitempty"` - EncodingID *string `json:"encodingId,omitempty"` - StartSegmentNumber *int64 `json:"startSegmentNumber,omitempty"` - SegmentPath *string `json:"segmentPath,omitempty"` -} - -type FMP4RepresentationData struct { - //Success fields - Result FMP4Representation `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type FMP4RepresentationResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data FMP4RepresentationData `json:"data,omitempty"` -} - -type DrmFMP4Representation struct { - ID *string `json:"id,omitempty"` - Type bitmovintypes.FMP4RepresentationType `json:"type,omitempty"` - MuxingID *string `json:"muxingId,omitempty"` - EncodingID *string `json:"encodingId,omitempty"` - StartSegmentNumber *string `json:"startSegmentNumber,omitempty"` - EndSegmentNumber *string `json:"endSegmentNumber,omitempty"` - SegmentPath *string `json:"segmentPath,omitempty"` - DrmID *string `json:"drmId,omitempty"` -} - -type DrmFMP4RepresentationData struct { - //Success fields - Result DrmFMP4Representation `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type DrmFMP4RepresentationResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data DrmFMP4RepresentationData `json:"data,omitempty"` -} - -type AdaptationSetContentProtection struct { - EncodingId *string `json:"encodingId,omitempty"` - MuxingId *string `json:"muxingId,omitempty"` - DrmId *string `json:"drmId"` -} - -type AdaptationSetContentProtectionData struct { - //Success fields - Result AdaptationSetContentProtection `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type AdaptationSetContentProtectionResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data AdaptationSetContentProtectionData `json:"data,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/data_envelope.go b/vendor/github.com/bitmovin/bitmovin-go/models/data_envelope.go deleted file mode 100644 index 0d82cad7..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/data_envelope.go +++ /dev/null @@ -1,20 +0,0 @@ -package models - -type DataEnvelope struct { - RequestID string `json:"requestId"` - Status string `json:"status"` - Data struct { - Code int `json:"code"` - Message string `json:"message"` - DeveloperMessage string `json:"developerMessage"` - Links []struct { - Href string `json:"href"` - Title string `json:"title"` - } `json:"links"` - Details []struct { - Type string `json:"type"` - Text string `json:"text"` - Field string `json:"field"` - } `json:"details"` - } `json:"data"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/detail.go b/vendor/github.com/bitmovin/bitmovin-go/models/detail.go deleted file mode 100644 index 06460a35..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/detail.go +++ /dev/null @@ -1,12 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type Detail struct { - Date *string `json:"date"` - ID *string `json:"id"` - Type bitmovintypes.MessageType `json:"type"` - Text *string `json:"text"` - Field *string `json:"field"` - Links []Link `json:"links"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/drms.go b/vendor/github.com/bitmovin/bitmovin-go/models/drms.go deleted file mode 100644 index 038c39c9..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/drms.go +++ /dev/null @@ -1,115 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type PlayReadyDrm struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Key *string `json:"key,omitempty"` - KID *string `json:"kid,omitempty"` - KeySeed *string `json:"keySeed,omitempty"` - LaUrl *string `json:"laUrl,omitempty"` - Method bitmovintypes.EncryptionMethod `json:"method,omitempty"` - Outputs []Output `json:"outputs,omitempty"` -} - -type FairPlayDrm struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Key *string `json:"key,omitempty"` - IV *string `json:"iv,omitempty"` - URI *string `json:"uri,omitempty"` - Outputs []Output `json:"outputs,omitempty"` -} - -type WidevineDrm struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Key *string `json:"key,omitempty"` - KID *string `json:"kid,omitempty"` - PSSH *string `json:"pssh,omitempty"` - Outputs []Output `json:"outputs,omitempty"` -} - -type WidevineCencDrm struct { - PSSH *string `json:"pssh,omitempty"` -} - -type PlayReadyCencDrm struct { - LaURL *string `json:"laUrl,omitEmpty"` - PSSH *string `json:"pssh,omitEmpty"` -} - -type CencDrm struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Key *string `json:"key,omitempty"` - KID *string `json:"kid,omitempty"` - Outputs []Output `json:"outputs,omitempty"` - Widevine WidevineCencDrm `json:"widevine,omitempty"` - PlayReady PlayReadyCencDrm `json:"playReady,omitEmpty"` -} - -type DrmResponseData struct { - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type WidevineDrmData struct { - DrmResponseData - Result WidevineDrm `json:"result,omitempty"` -} - -type FairPlayDrmData struct { - DrmResponseData - Result FairPlayDrm `json:"result,omitempty"` -} - -type PlayReadyDrmData struct { - DrmResponseData - Result PlayReadyDrm `json:"result,omitempty"` -} - -type CencDrmData struct { - DrmResponseData - Result CencDrm `json:"result,omitempty"` -} - -type DrmResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` -} - -type WidevineDrmResponse struct { - DrmResponse - Data WidevineDrmData `json:"data,omitempty"` -} - -type FairPlayDrmResponse struct { - DrmResponse - Data FairPlayDrmData `json:"data,omitempty"` -} - -type PlayReadyDrmResponse struct { - DrmResponse - Data PlayReadyDrmData `json:"data,omitempty"` -} - -type CencDrmResponse struct { - DrmResponse - Data CencDrmData `json:"data,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/encoding.go b/vendor/github.com/bitmovin/bitmovin-go/models/encoding.go deleted file mode 100644 index 0e519bb2..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/encoding.go +++ /dev/null @@ -1,334 +0,0 @@ -package models - -import ( - "github.com/bitmovin/bitmovin-go/bitmovintypes" -) - -type Encoding struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - EncoderVersion bitmovintypes.EncoderVersion `json:"encoderVersion,omitempty"` - CloudRegion bitmovintypes.CloudRegion `json:"cloudRegion,omitempty"` - Status string `json:"status,omitempty"` - InfrastructureID *string `json:"infrastructureId,omitempty"` -} - -type EncodingData struct { - //Success fields - Result Encoding `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type EncodingResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data EncodingData `json:"data,omitempty"` -} - -type EncodingListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []Encoding `json:"items,omitempty"` -} - -type EncodingListData struct { - Result EncodingListResult `json:"result,omitempty"` -} - -type EncodingListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data EncodingListData `json:"data,omitempty"` -} - -type InputStream struct { - InputID *string `json:"inputId,omitempty"` - InputPath *string `json:"inputPath,omitempty"` - SelectionMode bitmovintypes.SelectionMode `json:"selectionMode,omitempty"` - Position *int64 `json:"position,omitempty"` -} - -type ACLItem struct { - Scope *string `json:"scope,omitempty"` - Permission bitmovintypes.ACLPermission `json:"permission,omitempty"` -} - -type Output struct { - OutputID *string `json:"outputId,omitempty"` - OutputPath *string `json:"outputPath,omitempty"` - ACL []ACLItem `json:"acl,omitempty"` -} - -type StreamData struct { - //Success fields - Result Stream `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type StreamResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data StreamData `json:"data,omitempty"` -} - -type StreamListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []Stream `json:"items,omitempty"` -} - -type StreamListResponse struct { - Result StreamListResult `json:"result,omitempty"` -} - -type StreamItem struct { - StreamID *string `json:"streamId,omitempty"` -} - -type FMP4Muxing struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Streams []StreamItem `json:"streams,omitempty"` - Outputs []Output `json:"outputs,omitempty"` - SegmentLength *float64 `json:"segmentLength,omitempty"` - SegmentNaming *string `json:"segmentNaming,omitempty"` - InitSegmentName *string `json:"initSegmentName,omitempty"` - AvgBitrate *int `json:"avgBitrate,omitempty"` -} - -type FMP4MuxingData struct { - //Success fields - Result FMP4Muxing `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type FMP4MuxingResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data FMP4MuxingData `json:"data,omitempty"` -} - -type FMP4MuxingListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []FMP4Muxing `json:"items,omitempty"` -} - -type FMP4MuxingListData struct { - Result FMP4MuxingListResult `json:"result,omitempty"` -} - -type FMP4MuxingListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data FMP4MuxingListData `json:"data,omitempty"` -} - -type TSMuxing struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Streams []StreamItem `json:"streams,omitempty"` - Outputs []Output `json:"outputs,omitempty"` - SegmentLength *float64 `json:"segmentLength,omitempty"` - SegmentNaming *string `json:"segmentNaming,omitempty"` -} - -type TSMuxingData struct { - //Success fields - Result TSMuxing `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type TSMuxingResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data TSMuxingData `json:"data,omitempty"` -} - -type TSMuxingListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []TSMuxing `json:"items,omitempty"` -} - -type TSMuxingListData struct { - Result TSMuxingListResult `json:"result,omitempty"` -} - -type TSMuxingListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data TSMuxingListData `json:"data,omitempty"` -} - -type MP4Muxing struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Streams []StreamItem `json:"streams,omitempty"` - Outputs []Output `json:"outputs,omitempty"` - Filename *string `json:"filename,omitempty"` - FragmentDuration *int64 `json:"fragmentDuration,omitempty"` -} - -type MP4MuxingData struct { - //Success fields - Result MP4Muxing `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type MP4MuxingResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data MP4MuxingData `json:"data,omitempty"` -} - -type MP4MuxingListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []MP4Muxing `json:"items,omitempty"` -} - -type MP4MuxingListData struct { - Result MP4MuxingListResult `json:"result,omitempty"` -} - -type MP4MuxingListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data MP4MuxingListData `json:"data,omitempty"` -} - -type StartResult struct { - ID *string `json:"id,omitempty"` -} - -type StartData struct { - //Success fields - Result StartResult `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type StartStopResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data StartData `json:"data,omitempty"` -} - -type Subtask struct { - Status *string `json:"status,omitempty"` - Name *string `json:"name,omitempty"` - ETA *float64 `json:"eta,omitempty"` - Progress *float64 `json:"progress,omitempty"` -} - -type StatusResult struct { - Status *string `json:"status,omitempty"` - ETA *float64 `json:"eta,omitempty"` - Progress *float64 `json:"progress,omitempty"` - Messages []Message `json:"messages,omitempty"` - Subtasks []Subtask `json:"subtasks,omitempty"` -} - -type StatusData struct { - //Success fields - Result StatusResult `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type StatusResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data StatusData `json:"data,omitempty"` -} - -type LiveStreamConfiguration struct { - StreamKey *string `json:"streamKey,omitempty"` - HLSManifests []LiveHLSManifest `json:"hlsManifests,omitempty"` - DashManifests []LiveDashManifest `json:"dashManifests,omitempty"` -} - -type LiveStatusResult struct { - StreamKey *string `json:"streamKey,omitempty"` - EncoderIP *string `json:"encoderIp,omitempty"` -} - -type LiveStatusData struct { - //Success fields - Result LiveStatusResult `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type LiveStatusResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data LiveStatusData `json:"data,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/filters.go b/vendor/github.com/bitmovin/bitmovin-go/models/filters.go deleted file mode 100644 index 0cacb35c..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/filters.go +++ /dev/null @@ -1,40 +0,0 @@ -package models - -import ( - "github.com/bitmovin/bitmovin-go/bitmovintypes" -) - -type Filter struct { - ID *string `json:"id"` - Name *string `json:"name"` - Description *string `json:"description"` - CustomData map[string]interface{} `json:"customData"` -} - -type WatermarkFilter struct { - Filter - Image *string `json:"image"` - Left *int64 `json:"left"` - Right *int64 `json:"right"` - Top *int64 `json:"top"` - Bottom *int64 `json:"bottom"` -} - -type CropFilter struct { - Filter - Left *int64 `json:"left"` - Right *int64 `json:"right"` - Top *int64 `json:"top"` - Bottom *int64 `json:"bottom"` -} - -type RotationFilter struct { - Filter - Rotation *int64 `json:"rotation"` -} - -type DeinterlacingFilter struct { - Filter - Mode bitmovintypes.DeinterlacingMode `json:"mode"` - Parity bitmovintypes.PictureFieldParity `json:"parity"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/hls.go b/vendor/github.com/bitmovin/bitmovin-go/models/hls.go deleted file mode 100644 index 7170f555..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/hls.go +++ /dev/null @@ -1,111 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type HLSManifest struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Outputs []Output `json:"outputs,omitempty"` - ManifestName *string `json:"manifestName,omitempty"` -} - -type HLSManifestData struct { - //Success fields - Result HLSManifest `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type HLSManifestResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data HLSManifestData `json:"data,omitempty"` -} - -type LiveHLSManifest struct { - ManifestID *string `json:"manifestId,omitempty"` - TimeShift *float64 `json:"timeShift,omitempty"` -} - -type StreamInfo struct { - ID *string `json:"id,omitempty"` - URI *string `json:"uri,omitempty"` - Audio *string `json:"audio,omitempty"` - Video *string `json:"video,omitempty"` - Subtitles *string `json:"subtitles,omitempty"` - ClosedCaptions *string `json:"closedCaptions,omitempty"` - SegmentPath *string `json:"segmentPath,omitempty"` - EncodingID *string `json:"encodingId,omitempty"` - StreamID *string `json:"streamId,omitempty"` - MuxingID *string `json:"muxingId,omitempty"` - DRMID *string `json:"drmId,omitempty"` - StartSegmentNumber *int64 `json:"startSegmentNumber,omitempty"` - EndSegmentNumber *int64 `json:"endSegmentNumber,omitempty"` -} - -type StreamInfoData struct { - //Success fields - Result StreamInfo `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type StreamInfoResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data StreamInfoData `json:"data,omitempty"` -} - -type MediaInfo struct { - ID *string `json:"id,omitempty"` - Type bitmovintypes.MediaType `json:"type,omitempty"` - URI *string `json:"uri,omitempty"` - GroupID *string `json:"groupId,omitempty"` - Language *string `json:"language,omitempty"` - AssociatedLanguage *string `json:"assocLanguage,omitempty"` - Name *string `json:"name,omitempty"` - IsDefault *bool `json:"isDefault,omitempty"` - Autoselect *bool `json:"autoselect,omitempty"` - Forced *bool `json:"forced,omitempty"` - InstreamID *string `json:"instreamId,omitempty"` - Characteristics []string `json:"characteristics,omitempty"` - SegmentPath *string `json:"segmentPath,omitempty"` - EncodingID *string `json:"encodingId,omitempty"` - StreamID *string `json:"streamId,omitempty"` - MuxingID *string `json:"muxingId,omitempty"` - DRMID *string `json:"drmId,omitempty"` - StartSegmentNumber *int64 `json:"startSegmentNumber,omitempty"` - EndSegmentNumber *int64 `json:"endSegmentNumber,omitempty"` -} - -type MediaInfoData struct { - //Success fields - Result MediaInfo `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type MediaInfoResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data MediaInfoData `json:"data,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/infrastructure.go b/vendor/github.com/bitmovin/bitmovin-go/models/infrastructure.go deleted file mode 100644 index 1b0ed35a..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/infrastructure.go +++ /dev/null @@ -1,41 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type CreateInfrastructureRequest struct { - Name *string `json:"name"` - Description *string `json:"description"` -} - -type InfrastructureDetail struct { - Name string `json:"name"` - Description string `json:"description"` - ID string `json:"id"` - Online bool `json:"online"` - Connected bool `json:"connected"` - AgentDeploymentDownloadURL string `json:"agentDeploymentDownloadUrl"` -} - -type InfrastructureResponseData struct { - Result InfrastructureDetail `json:"Result"` -} - -type InfrastructureResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data InfrastructureResponseData `json:"data,omitempty"` -} -type InfrastructureListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []InfrastructureDetail `json:"items,omitempty"` -} -type InfrastructureListResponseData struct { - Result InfrastructureListResult `json:"result,omitempty"` -} -type InfrastructureListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data InfrastructureListResponseData `json:"data,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/inputs.go b/vendor/github.com/bitmovin/bitmovin-go/models/inputs.go deleted file mode 100644 index c081c38d..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/inputs.go +++ /dev/null @@ -1,315 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type AsperaInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Host *string `json:"host,omitempty"` - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - MinBandwidth *string `json:"minBandwidth,omitempty"` - MaxBandwidth *string `json:"maxBandwidth,omitempty"` -} - -type AzureInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - AccountName *string `json:"accountName,omitempty"` - AccountKey *string `json:"accountKey,omitempty"` - Container *string `json:"container,omitempty"` -} - -type FTPInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Host *string `json:"host,omitempty"` - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Passive *bool `json:"passive,omitempty"` -} - -type GCSInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` - SecretKey *string `json:"secretKey,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.GoogleCloudRegion `json:"cloudRegion,omitempty"` -} - -type GCSInputItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.AWSCloudRegion `json:"cloudRegion,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -type GCSInputData struct { - //Success fields - Result GCSInputItem `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type GCSInputResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data GCSInputData `json:"data,omitempty"` -} - -type GCSInputListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []GCSInputItem `json:"items,omitempty"` -} - -type GCSInputListData struct { - Result GCSInputListResult `json:"result,omitempty"` -} - -type GCSInputListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data GCSInputListData `json:"data,omitempty"` -} - -type HTTPInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Host *string `json:"host,omitempty"` - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` -} - -type HTTPInputItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Host *string `json:"host,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -type HTTPInputData struct { - //Success fields - Result HTTPInputItem `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type HTTPInputResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data HTTPInputData `json:"data,omitempty"` -} - -type HTTPInputListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []HTTPInputItem `json:"items,omitempty"` -} - -type HTTPInputListData struct { - Result S3InputListResult `json:"result,omitempty"` -} - -type HTTPInputListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data S3InputListData `json:"data,omitempty"` -} - -type HTTPSInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Host *string `json:"host,omitempty"` - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` -} - -type HTTPSInputItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Host *string `json:"host,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -type HTTPSInputData struct { - //Success fields - Result HTTPSInputItem `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type HTTPSInputResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data HTTPSInputData `json:"data,omitempty"` -} - -type HTTPSInputListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []HTTPSInputItem `json:"items,omitempty"` -} - -type HTTPSInputListData struct { - Result S3InputListResult `json:"result,omitempty"` -} - -type HTTPSInputListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data S3InputListData `json:"data,omitempty"` -} - -type S3Input struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` - SecretKey *string `json:"secretKey,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.AWSCloudRegion `json:"cloudRegion,omitempty"` -} - -type S3InputItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.AWSCloudRegion `json:"cloudRegion,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -type S3InputData struct { - //Success fields - Result S3InputItem `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type S3InputResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data S3InputData `json:"data,omitempty"` -} - -type S3InputListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []S3InputItem `json:"items,omitempty"` -} - -type S3InputListData struct { - Result S3InputListResult `json:"result,omitempty"` -} - -type S3InputListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data S3InputListData `json:"data,omitempty"` -} - -type SFTPInput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Host *string `json:"host,omitempty"` - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Passive *bool `json:"passive,omitempty"` -} - -type RTMPInputItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -type RTMPInputData struct { - //Success fields - Result RTMPInputItem `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type RTMPInputResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data RTMPInputData `json:"data,omitempty"` -} - -type RTMPInputListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []RTMPInputItem `json:"items,omitempty"` -} - -type RTMPInputListData struct { - Result RTMPInputListResult `json:"result,omitempty"` -} - -type RTMPInputListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data RTMPInputListData `json:"data,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/link.go b/vendor/github.com/bitmovin/bitmovin-go/models/link.go deleted file mode 100644 index 554d3906..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/link.go +++ /dev/null @@ -1,6 +0,0 @@ -package models - -type Link struct { - HRef *string `json:"href"` - Title *string `json:"title"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/message.go b/vendor/github.com/bitmovin/bitmovin-go/models/message.go deleted file mode 100644 index 267bd7e9..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/message.go +++ /dev/null @@ -1,12 +0,0 @@ -package models - -import ( - "github.com/bitmovin/bitmovin-go/bitmovintypes" -) - -type Message struct { - Date *string `json:"date"` - ID *string `json:"id"` - Type bitmovintypes.MessageType `json:"type"` - Text *string `json:"text"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/outputs.go b/vendor/github.com/bitmovin/bitmovin-go/models/outputs.go deleted file mode 100644 index d9d6685c..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/outputs.go +++ /dev/null @@ -1,149 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type AzureOutput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - AccountName *string `json:"accountName,omitempty"` - AccountKey *string `json:"accountKey,omitempty"` - Container *string `json:"container,omitempty"` -} - -type FTPOutput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Host *string `json:"host,omitempty"` - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Passive *bool `json:"passive,omitempty"` -} - -type GCSOutput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` - SecretKey *string `json:"secretKey,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.GoogleCloudRegion `json:"cloudRegion,omitempty"` -} - -type GCSOutputItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.AWSCloudRegion `json:"cloudRegion,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -type GCSOutputData struct { - //Success fields - Result GCSOutputItem `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type GCSOutputResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data GCSOutputData `json:"data,omitempty"` -} - -type GCSOutputListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []GCSOutputItem `json:"items,omitempty"` -} - -type GCSOutputListData struct { - Result GCSOutputListResult `json:"result,omitempty"` -} - -type GCSOutputListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data GCSOutputListData `json:"data,omitempty"` -} - -type S3Output struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` - SecretKey *string `json:"secretKey,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.AWSCloudRegion `json:"cloudRegion,omitempty"` -} - -type S3OutputItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - BucketName *string `json:"bucketName,omitempty"` - CloudRegion bitmovintypes.AWSCloudRegion `json:"cloudRegion,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -type S3OutputData struct { - //Success fields - Result S3OutputItem `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` - - //Error fields - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - DeveloperMessage *string `json:"developerMessage,omitempty"` - Links []Link `json:"links,omitempty"` - Details []Detail `json:"details,omitempty"` -} - -type S3OutputResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data S3OutputData `json:"data,omitempty"` -} - -type S3OutputListResult struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []S3OutputItem `json:"items,omitempty"` -} - -type S3OutputListData struct { - Result S3OutputListResult `json:"result,omitempty"` -} - -type S3OutputListResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data S3OutputListData `json:"data,omitempty"` -} - -type SFTPOutput struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - Host *string `json:"host,omitempty"` - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Passive *bool `json:"passive,omitempty"` -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/stream.go b/vendor/github.com/bitmovin/bitmovin-go/models/stream.go deleted file mode 100644 index 37530701..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/stream.go +++ /dev/null @@ -1,48 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type Stream struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - CustomData map[string]interface{} `json:"customData,omitempty"` - InputStreams []InputStream `json:"inputStreams,omitempty"` - CodecConfigurationID *string `json:"codecConfigId,omitempty"` - Outputs []Output `json:"outputs,omitempty"` - Conditions *StreamCondition `json:"conditions,omitempty"` -} - -type StreamCondition struct { - Attribute bitmovintypes.ConditionAttribute `json:"attribute,omitempty"` - Operator string `json:"operator,omitempty"` - Value string `json:"value,omitempty"` - Type bitmovintypes.ConditionType `json:"type"` - Conditions []*StreamCondition `json:"conditions,omitempty"` -} - -// NewAttributeCondition creates a Condition that tests an attribute against a value given the operator -func NewAttributeCondition(attribute bitmovintypes.ConditionAttribute, operator, value string) *StreamCondition { - return &StreamCondition{ - Attribute: attribute, - Type: bitmovintypes.ConditionTypeCondition, - Operator: operator, - Value: value, - } -} - -// NewAndConjunction creates a logical Conjunction (AND) of all the condition parameters -func NewAndConjunction(conditions ...*StreamCondition) *StreamCondition { - return &StreamCondition{ - Type: bitmovintypes.ConditionTypeAnd, - Conditions: conditions, - } -} - -// NewOrDisjunction creates a logical Disjunction (OR) of all the condition parameters -func NewOrDisjunction(conditions ...*StreamCondition) *StreamCondition { - return &StreamCondition{ - Type: bitmovintypes.ConditionTypeOr, - Conditions: conditions, - } -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/stream_test.go b/vendor/github.com/bitmovin/bitmovin-go/models/stream_test.go deleted file mode 100644 index 06ee7f04..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/stream_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package models - -import ( - "testing" - - "github.com/bitmovin/bitmovin-go/bitmovintypes" -) - -func TestConditionBuilder(t *testing.T) { - condition := NewAttributeCondition(bitmovintypes.ConditionAttributeFPS, "==", "25") - testCondition(condition, t) -} - -func testCondition(condition *StreamCondition, t *testing.T) { - if condition.Type != bitmovintypes.ConditionTypeCondition { - t.Errorf("Wanted ConditionType Condition got %v", condition.Type) - } - if condition.Attribute != bitmovintypes.ConditionAttributeFPS { - t.Errorf("Wanted Attribute FPS got %v", condition.Attribute) - } - if condition.Operator != "==" { - t.Errorf("Wanted Value == got %v", condition.Operator) - } - if condition.Value != "25" { - t.Errorf("Wanted Value 25 got %v", condition.Value) - } -} - -func TestNewAndConjunction(t *testing.T) { - cond := NewAndConjunction( - NewAttributeCondition(bitmovintypes.ConditionAttributeFPS, "==", "25"), - ) - - if cond.Type != bitmovintypes.ConditionTypeAnd { - t.Errorf("Wanted AndConjunction Type to be AND got %v", cond.Type) - } - - if len(cond.Conditions) != 1 { - t.Fatalf("Wanted 1 Condition, got %d", len(cond.Conditions)) - } - condition := cond.Conditions[0] - testCondition(condition, t) -} - -func TestNewOrDisjunction(t *testing.T) { - cond := NewOrDisjunction( - NewAttributeCondition(bitmovintypes.ConditionAttributeFPS, "==", "25"), - ) - if cond.Type != bitmovintypes.ConditionTypeOr { - t.Errorf("Wanted AndConjunction Type to be OR got %v", cond.Type) - } - - if len(cond.Conditions) != 1 { - t.Fatalf("Wanted 1 Condition, got %d", len(cond.Conditions)) - } - condition := cond.Conditions[0] - testCondition(condition, t) -} - -func buildNestedCondition() *StreamCondition { - return NewOrDisjunction( - NewAndConjunction( - NewAttributeCondition(bitmovintypes.ConditionAttributeFPS, "==", "25"), - NewAttributeCondition(bitmovintypes.ConditionAttributeBitrate, "==", "14000"), - ), - NewAndConjunction( - NewAttributeCondition(bitmovintypes.ConditionAttributeFPS, "==", "60"), - NewAttributeCondition(bitmovintypes.ConditionAttributeBitrate, "==", "7000"), - ), - ) -} - -func TestNestedConditions(t *testing.T) { - cond := buildNestedCondition() - if cond.Type != bitmovintypes.ConditionTypeOr { - t.Errorf("Wanted ConditionType OR got %v", cond.Type) - } - if len(cond.Conditions) != 2 { - t.Fatalf("Wanted 2 Conditions, got %d", len(cond.Conditions)) - } - firstCond := cond.Conditions[0] - if firstCond.Type != bitmovintypes.ConditionTypeAnd { - t.Errorf("Expected ConditionType of first nested Condition to be AND got %v", firstCond.Type) - } - secondCond := cond.Conditions[1] - if secondCond.Type != bitmovintypes.ConditionTypeAnd { - t.Errorf("Expected ConditionType of second nested Condition to be AND got %v", secondCond.Type) - } -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail.go b/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail.go deleted file mode 100644 index 002a88cb..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail.go +++ /dev/null @@ -1,45 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type Thumbnail struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Height int `json:"height,omitempty"` - PositionUnit bitmovintypes.PositionUnit `json:"unit,omitempty"` - Positions []float64 `json:"positions,omitempty"` - Pattern *string `json:"pattern,omitempty"` - Outputs []Output `json:"outputs,omitempty"` -} - -type ThumbnailData struct { - Result Thumbnail `json:"result,omitempty"` - Messages []Message `json:"messages,omitempty"` -} - -type ThumbnailResponse struct { - RequestID *string `json:"requestId,omitempty"` - Status bitmovintypes.ResponseStatus `json:"status,omitempty"` - Data ThumbnailData `json:"data,omitempty"` -} - -type ThumbnailListResponse struct { - TotalCount *int64 `json:"totalCount,omitempty"` - Previous *string `json:"previous,omitempty"` - Next *string `json:"next,omitempty"` - Items []Thumbnail `json:"items,omitempty"` -} - -func NewThumbnail(height int, positions []float64, outputs []Output) *Thumbnail { - return &Thumbnail{ - Height: height, - Positions: positions, - Outputs: outputs, - } -} - -func (t *Thumbnail) Builder() *ThumbnailBuilder { - return &ThumbnailBuilder{ - Thumbnail: t, - } -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail_builder.go b/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail_builder.go deleted file mode 100644 index abf1d0b5..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail_builder.go +++ /dev/null @@ -1,40 +0,0 @@ -package models - -import "github.com/bitmovin/bitmovin-go/bitmovintypes" - -type ThumbnailBuilder struct { - Thumbnail *Thumbnail -} - -func (t *ThumbnailBuilder) Name(name string) *ThumbnailBuilder { - t.Thumbnail.Name = &name - return t -} -func (t *ThumbnailBuilder) Description(desc string) *ThumbnailBuilder { - t.Thumbnail.Description = &desc - return t -} - -func (t *ThumbnailBuilder) Height(h int) *ThumbnailBuilder { - t.Thumbnail.Height = h - return t -} -func (t *ThumbnailBuilder) PositionUnit(u bitmovintypes.PositionUnit) *ThumbnailBuilder { - t.Thumbnail.PositionUnit = u - return t -} -func (t *ThumbnailBuilder) Positions(pos []float64) *ThumbnailBuilder { - t.Thumbnail.Positions = pos - return t -} -func (t *ThumbnailBuilder) Pattern(p string) *ThumbnailBuilder { - t.Thumbnail.Pattern = &p - return t -} -func (t *ThumbnailBuilder) Outputs(o []Output) *ThumbnailBuilder { - t.Thumbnail.Outputs = o - return t -} -func (t *ThumbnailBuilder) Build() *Thumbnail { - return t.Thumbnail -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail_test.go b/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail_test.go deleted file mode 100644 index cce53c8d..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/models/thumbnail_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package models - -import "testing" - -func TestBuilder(t *testing.T) { - thumb := NewThumbnail(300, []float64{1, 5, 30}, []Output{Output{}}) - thumb = thumb.Builder(). - Name("Test Thumbnail"). - Build() - - if *thumb.Name != "Test Thumbnail" { - t.Error("Wanted Thumbnail Name to be `Test Thumbnail` got %s", *thumb.Name) - } - - if thumb.Description != nil { - t.Error("Wanted Thumbnail Description to be nil, got %v", thumb.Description) - } - - // Test that it's manipulating references - thumb.Builder().Description("My Desc") - - if *thumb.Description != "My Desc" { - t.Error("Wanted Thumbnail Description to be `My Desc`, got %v", thumb.Description) - } -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/aac_codec_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/aac_codec_configuration_service.go deleted file mode 100644 index 9cc537bf..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/aac_codec_configuration_service.go +++ /dev/null @@ -1,95 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type AACCodecConfigurationService struct { - RestService *RestService -} - -const ( - AACCodecConfigurationEndpoint string = "encoding/configurations/audio/aac" -) - -func NewAACCodecConfigurationService(bitmovin *bitmovin.Bitmovin) *AACCodecConfigurationService { - r := NewRestService(bitmovin) - - return &AACCodecConfigurationService{RestService: r} -} - -func (s *AACCodecConfigurationService) Create(a *models.AACCodecConfiguration) (*models.AACCodecConfigurationResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - - o, err := s.RestService.Create(AACCodecConfigurationEndpoint, b) - if err != nil { - return nil, err - } - var r models.AACCodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *AACCodecConfigurationService) Retrieve(id string) (*models.AACCodecConfigurationResponse, error) { - path := AACCodecConfigurationEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.AACCodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *AACCodecConfigurationService) Delete(id string) (*models.AACCodecConfigurationResponse, error) { - path := AACCodecConfigurationEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.AACCodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *AACCodecConfigurationService) List(offset int64, limit int64) (*models.AACCodecConfigurationListResponse, error) { - o, err := s.RestService.List(AACCodecConfigurationEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.AACCodecConfigurationListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *AACCodecConfigurationService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := AACCodecConfigurationEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/aac_codec_configuration_service_test.go b/vendor/github.com/bitmovin/bitmovin-go/services/aac_codec_configuration_service_test.go deleted file mode 100644 index 5e568ea8..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/aac_codec_configuration_service_test.go +++ /dev/null @@ -1 +0,0 @@ -package services diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/codec_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/codec_configuration_service.go deleted file mode 100644 index 043fc0e5..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/codec_configuration_service.go +++ /dev/null @@ -1,36 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type CodecConfigurationService struct { - RestService *RestService -} - -const ( - CodecConfigurationEndpoint string = "configurations" -) - -func NewCodecConfigurationService(bitmovin *bitmovin.Bitmovin) *CodecConfigurationService { - // FIXME correct endpoint? - r := NewRestService(bitmovin) - - return &CodecConfigurationService{RestService: r} -} - -func (s *CodecConfigurationService) List(offset int64, limit int64) (*models.CodecConfigurationListResponse, error) { - o, err := s.RestService.List(CodecConfigurationEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.CodecConfigurationListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/dash_manifest_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/dash_manifest_service.go deleted file mode 100644 index 0f66fec8..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/dash_manifest_service.go +++ /dev/null @@ -1,346 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type DashManifestService struct { - RestService *RestService -} - -const ( - DashManifestEndpoint string = "encoding/manifests/dash" -) - -func NewDashManifestService(bitmovin *bitmovin.Bitmovin) *DashManifestService { - r := NewRestService(bitmovin) - - return &DashManifestService{RestService: r} -} - -func (s *DashManifestService) Create(a *models.DashManifest) (*models.DashManifestResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - - o, err := s.RestService.Create(DashManifestEndpoint, b) - if err != nil { - return nil, err - } - var r models.DashManifestResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) Retrieve(id string) (*models.DashManifestResponse, error) { - path := DashManifestEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.DashManifestResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) Delete(id string) (*models.DashManifestResponse, error) { - path := DashManifestEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.DashManifestResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) AddPeriod(manifestID string, a *models.Period) (*models.PeriodResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.PeriodResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) RetrievePeriod(manifestID string, streamID string) (*models.PeriodResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + streamID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.PeriodResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) DeletePeriod(manifestID string, streamID string) (*models.PeriodResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + streamID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.PeriodResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) AddAudioAdaptationSet(manifestID string, periodID string, a *models.AudioAdaptationSet) (*models.AudioAdaptationSetResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/audio" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.AudioAdaptationSetResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) RetrieveAudioAdaptationSet(manifestID string, periodID string, adaptationSetID string, a *models.AudioAdaptationSet) (*models.AudioAdaptationSetResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/audio/" + adaptationSetID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.AudioAdaptationSetResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) DeleteAudioAdaptationSet(manifestID string, periodID string, adaptationSetID string, a *models.AudioAdaptationSet) (*models.AudioAdaptationSetResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/audio/" + adaptationSetID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.AudioAdaptationSetResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) AddVideoAdaptationSet(manifestID string, periodID string, a *models.VideoAdaptationSet) (*models.VideoAdaptationSetResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/video" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.VideoAdaptationSetResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) RetrieveVideoAdaptationSet(manifestID string, periodID string, adaptationSetID string, a *models.VideoAdaptationSet) (*models.VideoAdaptationSetResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/video/" + adaptationSetID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.VideoAdaptationSetResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) DeleteVideoAdaptationSet(manifestID string, periodID string, adaptationSetID string, a *models.VideoAdaptationSet) (*models.VideoAdaptationSetResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/video/" + adaptationSetID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.VideoAdaptationSetResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) AddFMP4Representation(manifestID string, periodID string, adaptationSetID string, a *models.FMP4Representation) (*models.FMP4RepresentationResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/" + adaptationSetID + "/representations/fmp4" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.FMP4RepresentationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) RetrieveFMP4Representation(manifestID string, periodID string, adaptationSetID string, representationID string) (*models.FMP4RepresentationResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/" + adaptationSetID + "/representations/fmp4/" + representationID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.FMP4RepresentationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) DeleteFMP4Representation(manifestID string, periodID string, adaptationSetID string, representationID string) (*models.FMP4RepresentationResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/" + adaptationSetID + "/representations/fmp4/" + representationID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.FMP4RepresentationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) AddDrmFMP4Representation(manifestID string, periodID string, adaptationSetID string, a *models.DrmFMP4Representation) (*models.DrmFMP4RepresentationResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/" + adaptationSetID + "/representations/fmp4/drm" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.DrmFMP4RepresentationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) RetrieveDrmFMP4Representation(manifestID string, periodID string, adaptationSetID string, representationID string) (*models.DrmFMP4RepresentationResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/" + adaptationSetID + "/representations/fmp4/drm/" + representationID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.DrmFMP4RepresentationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) DeleteDrmFMP4Representation(manifestID string, periodID string, adaptationSetID string, representationID string) (*models.DrmFMP4RepresentationResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/" + "periods" + "/" + periodID + "/adaptationsets/" + adaptationSetID + "/representations/fmp4/drm/" + representationID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.DrmFMP4RepresentationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) Start(manifestID string) (*models.StartStopResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/start" - o, err := s.RestService.Create(path, nil) - if err != nil { - return nil, err - } - var r models.StartStopResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) RetrieveStatus(manifestID string) (*models.StatusResponse, error) { - path := DashManifestEndpoint + "/" + manifestID + "/status" - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.StatusResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *DashManifestService) AddContentProtectionToAdaptationSet(manifestID string, periodID string, adaptationSetID string, a *models.AdaptationSetContentProtection) (*models.AdaptationSetContentProtectionResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - - path := DashManifestEndpoint + "/" + manifestID + "/periods/" + periodID + "/adaptationsets/" + adaptationSetID + "/contentprotection" - - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.AdaptationSetContentProtectionResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/drm_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/drm_service.go deleted file mode 100644 index 79db06a4..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/drm_service.go +++ /dev/null @@ -1,148 +0,0 @@ -package services - -import ( - "encoding/json" - "errors" - "fmt" - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" - "strings" -) - -type DrmService struct { - RestService *RestService -} - -const ( - Fmp4DrmEndpoint string = "encoding/encodings/{encoding_id}/muxings/fmp4/{fmp4_id}/drm" - TsDrmEndpoint string = "encoding/encodings/{encoding_id}/muxings/ts/{ts_id}/drm" -) - -func NewDrmService(bitmovin *bitmovin.Bitmovin) *DrmService { - return &DrmService{RestService: NewRestService(bitmovin)} -} - -func (s *DrmService) CreateFmp4Drm(encodingId string, fmp4MuxingId string, drm interface{}) (interface{}, error) { - - replacer := strings.NewReplacer( - "{encoding_id}", encodingId, - "{fmp4_id}", fmp4MuxingId, - ) - requestUrl := replacer.Replace(Fmp4DrmEndpoint) - - switch v := drm.(type) { - case models.WidevineDrm: - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - - enpointUrl := requestUrl + "/widevine" - response, err := s.RestService.Create(enpointUrl, b) - if err != nil { - return nil, err - } - - var result models.WidevineDrmResponse - err = json.Unmarshal(response, &result) - if err != nil { - return nil, err - } - return &result, nil - - case models.PlayReadyDrm: - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - - endpointUrl := requestUrl + "/playready" - response, err := s.RestService.Create(endpointUrl, b) - if err != nil { - return nil, err - } - - var result models.PlayReadyDrmResponse - err = json.Unmarshal(response, &result) - if err != nil { - return nil, err - } - return &result, nil - - case models.FairPlayDrm: - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - - endpointUrl := requestUrl + "/fairplay" - response, err := s.RestService.Create(endpointUrl, b) - if err != nil { - return nil, err - } - - var result models.FairPlayDrmResponse - err = json.Unmarshal(response, &result) - if err != nil { - return nil, err - } - return &result, nil - - case models.CencDrm: - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - - endpointUrl := requestUrl + "/cenc" - response, err := s.RestService.Create(endpointUrl, b) - if err != nil { - return nil, err - } - - var result models.CencDrmResponse - err = json.Unmarshal(response, &result) - if err != nil { - return nil, err - } - return &result, nil - - default: - err := fmt.Sprintf("FMP4 DRM type %T is not supported!\n", v) - return nil, errors.New(err) - } -} - -func (s *DrmService) CreateTsDrm(encodingId string, tsMuxingId string, drm interface{}) (interface{}, error) { - - replacer := strings.NewReplacer( - "{encoding_id}", encodingId, - "{ts_id}", tsMuxingId, - ) - requestUrl := replacer.Replace(TsDrmEndpoint) - - switch v := drm.(type) { - case models.FairPlayDrm: - b, err := json.Marshal(v) - if err != nil { - return nil, err - } - - enpointUrl := requestUrl + "/fairplay" - response, err := s.RestService.Create(enpointUrl, b) - if err != nil { - return nil, err - } - - var result models.FairPlayDrmResponse - err = json.Unmarshal(response, &result) - if err != nil { - return nil, err - } - return &result, nil - - default: - err := fmt.Sprintf("TS DRM type %T is not supported!\n", v) - return nil, errors.New(err) - } -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/encoding_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/encoding_service.go deleted file mode 100644 index 670fbd85..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/encoding_service.go +++ /dev/null @@ -1,511 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type EncodingService struct { - RestService *RestService -} - -const ( - EncodingEndpoint string = "encoding/encodings" -) - -func NewEncodingService(bitmovin *bitmovin.Bitmovin) *EncodingService { - r := NewRestService(bitmovin) - - return &EncodingService{RestService: r} -} - -func (s *EncodingService) Create(a *models.Encoding) (*models.EncodingResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(EncodingEndpoint, b) - if err != nil { - return nil, err - } - var r models.EncodingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) Retrieve(id string) (*models.EncodingResponse, error) { - path := EncodingEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.EncodingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) Delete(id string) (*models.EncodingResponse, error) { - path := EncodingEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.EncodingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) List(offset int64, limit int64) (*models.EncodingListResponse, error) { - o, err := s.RestService.List(EncodingEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.EncodingListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := EncodingEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) AddStream(encodingID string, a *models.Stream) (*models.StreamResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := EncodingEndpoint + "/" + encodingID + "/" + "streams" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.StreamResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveStream(encodingID string, streamID string) (*models.StreamResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "streams" + "/" + streamID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.StreamResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) DeleteStream(encodingID string, streamID string) (*models.StreamResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "streams" + "/" + streamID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.StreamResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) ListStream(encodingID string, offset int64, limit int64) (*models.StreamListResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "streams" - o, err := s.RestService.List(path, offset, limit) - if err != nil { - return nil, err - } - var r models.StreamListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveStreamCustomData(encodingID string, streamID string, offset int64, limit int64) (*models.CustomDataResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "streams" + "/" + streamID - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) AddFMP4Muxing(encodingID string, a *models.FMP4Muxing) (*models.FMP4MuxingResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/fmp4" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.FMP4MuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveFMP4Muxing(encodingID string, fmp4ID string) (*models.FMP4MuxingResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/fmp4" + "/" + fmp4ID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.FMP4MuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) DeleteFMP4Muxing(encodingID string, fmp4ID string) (*models.FMP4MuxingResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/fmp4" + "/" + fmp4ID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.FMP4MuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) ListFMP4Muxing(encodingID string, offset int64, limit int64) (*models.FMP4MuxingListResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/fmp4" - o, err := s.RestService.List(path, offset, limit) - if err != nil { - return nil, err - } - var r models.FMP4MuxingListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveFMP4MuxingCustomData(encodingID string, fmp4ID string, offset int64, limit int64) (*models.CustomDataResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/fmp4" + "/" + fmp4ID - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) AddTSMuxing(encodingID string, a *models.TSMuxing) (*models.TSMuxingResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/ts" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.TSMuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveTSMuxing(encodingID string, tsID string) (*models.TSMuxingResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/ts" + "/" + tsID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.TSMuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) DeleteTSMuxing(encodingID string, tsID string) (*models.TSMuxingResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/ts" + "/" + tsID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.TSMuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) ListTSMuxing(encodingID string, offset int64, limit int64) (*models.TSMuxingListResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/ts" - o, err := s.RestService.List(path, offset, limit) - if err != nil { - return nil, err - } - var r models.TSMuxingListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveTSMuxingCustomData(encodingID string, tsID string, offset int64, limit int64) (*models.CustomDataResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/ts" + "/" + tsID - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) AddMP4Muxing(encodingID string, a *models.MP4Muxing) (*models.MP4MuxingResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/mp4" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.MP4MuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveMP4Muxing(encodingID string, mp4ID string) (*models.MP4MuxingResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/mp4" + "/" + mp4ID - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.MP4MuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) DeleteMP4Muxing(encodingID string, mp4ID string) (*models.MP4MuxingResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/mp4" + "/" + mp4ID - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.MP4MuxingResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) ListMP4Muxing(encodingID string, offset int64, limit int64) (*models.MP4MuxingListResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/mp4" - o, err := s.RestService.List(path, offset, limit) - if err != nil { - return nil, err - } - var r models.MP4MuxingListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveMP4MuxingCustomData(encodingID string, mp4ID string, offset int64, limit int64) (*models.CustomDataResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + "muxings/mp4" + "/" + mp4ID - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) Start(encodingID string) (*models.StartStopResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/start" - o, err := s.RestService.Create(path, nil) - if err != nil { - return nil, err - } - var r models.StartStopResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -// Stop and Start use the same model -func (s *EncodingService) Stop(encodingID string) (*models.StartStopResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/stop" - o, err := s.RestService.Create(path, nil) - if err != nil { - return nil, err - } - var r models.StartStopResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveStatus(encodingID string) (*models.StatusResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/status" - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.StatusResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) StartLive(encodingID string, a *models.LiveStreamConfiguration) (*models.StartStopResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := EncodingEndpoint + "/" + encodingID + "/live/start" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.StartStopResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) StopLive(encodingID string) (*models.StartStopResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/live/stop" - o, err := s.RestService.Create(path, nil) - if err != nil { - return nil, err - } - var r models.StartStopResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) RetrieveLiveStatus(encodingID string) (*models.LiveStatusResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/live" - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.LiveStatusResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) AddThumbnail(encodingID, streamID string, thumb *models.Thumbnail) (*models.ThumbnailResponse, error) { - payload, err := json.Marshal(thumb) - if err != nil { - return nil, err - } - - path := EncodingEndpoint + "/" + encodingID + "/streams/" + streamID + "/thumbnails" - resp, err := s.RestService.Create(path, payload) - if err != nil { - return nil, err - } - var r models.ThumbnailResponse - if err := json.Unmarshal(resp, &r); err != nil { - return nil, err - } - return &r, nil -} - -func (s *EncodingService) ListThumbnails(encodingID, streamID string, offset, limit int64) (*models.ThumbnailListResponse, error) { - path := EncodingEndpoint + "/" + encodingID + "/" + streamID + "/thumbnails" - o, err := s.RestService.List(path, offset, limit) - if err != nil { - return nil, err - } - var r models.ThumbnailListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/gcp_output_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/gcp_output_configuration_service.go deleted file mode 100644 index f66fb293..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/gcp_output_configuration_service.go +++ /dev/null @@ -1,94 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type GCSOutputService struct { - RestService *RestService -} - -const ( - GCSOutputEndpoint string = "encoding/outputs/gcs" -) - -func NewGCSOutputService(bitmovin *bitmovin.Bitmovin) *GCSOutputService { - r := NewRestService(bitmovin) - - return &GCSOutputService{RestService: r} -} - -func (s *GCSOutputService) Create(a *models.GCSOutput) (*models.GCSOutputResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(GCSOutputEndpoint, b) - if err != nil { - return nil, err - } - var r models.GCSOutputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GCSOutputService) Retrieve(id string) (*models.GCSOutputResponse, error) { - path := GCSOutputEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.GCSOutputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GCSOutputService) Delete(id string) (*models.GCSOutputResponse, error) { - path := GCSOutputEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.GCSOutputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GCSOutputService) List(offset int64, limit int64) (*models.GCSOutputListResponse, error) { - o, err := s.RestService.List(GCSOutputEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.GCSOutputListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GCSOutputService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := GCSOutputEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/gcs_input_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/gcs_input_configuration_service.go deleted file mode 100644 index cfb13f6e..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/gcs_input_configuration_service.go +++ /dev/null @@ -1,93 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type GcsInputService struct { - RestService *RestService -} - -const ( - GcsInputEndpoint string = "encoding/inputs/gcs" -) - -func NewGCSInputService(bitmovin *bitmovin.Bitmovin) *GcsInputService { - r := NewRestService(bitmovin) - return &GcsInputService{RestService: r} -} - -func (s *GcsInputService) Create(a *models.GCSInput) (*models.GCSInputResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(GcsInputEndpoint, b) - if err != nil { - return nil, err - } - var r models.GCSInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GcsInputService) Retrieve(id string) (*models.GCSInputResponse, error) { - path := GcsInputEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.GCSInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GcsInputService) Delete(id string) (*models.GCSInputResponse, error) { - path := GcsInputEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.GCSInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GcsInputService) List(offset int64, limit int64) (*models.GCSInputListResponse, error) { - o, err := s.RestService.List(GcsInputEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.GCSInputListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *GcsInputService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := GcsInputEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/gcs_input_configuration_service_test.go b/vendor/github.com/bitmovin/bitmovin-go/services/gcs_input_configuration_service_test.go deleted file mode 100644 index b4b0098f..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/gcs_input_configuration_service_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package services - -import ( - "encoding/json" - "testing" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -const apiKey = "INSERT_API_KEY" - -func createClient() *RestService { - bitmovin := bitmovin.NewBitmovinDefaultTimeout(apiKey, "https://api.bitmovin.com/v1/") - return NewRestService(bitmovin) -} - -func TestCreate(t *testing.T) { - svc := createClient() - gcsInput := &models.GCSInput{ - AccessKey: stringToPtr(""), - SecretKey: stringToPtr(""), - BucketName: stringToPtr(""), - } - json, _ := json.Marshal(*gcsInput) - _, err := svc.Create(`encoding/inputs/gcs`, json) - - if err == nil { - t.Fatal("Expected to receive error") - } - if err.Error() != "ERROR 1000: One or more fields are not present or invalid" { - t.Fatalf("Expected error message - got %s", err.Error()) - } -} - -func TestRetrieve(t *testing.T) { - svc := createClient() - _, err := svc.Retrieve(`encoding/inputs/gcs/invalid-id`) - if err == nil { - t.Fatal("Expected to receive error - got nil") - } - if err.Error() != "ERROR 1001: Input with the given id was not found in our system" { - t.Fatalf("Expected error message - got %s", err.Error()) - } -} - -func TestDelete(t *testing.T) { - svc := createClient() - _, err := svc.Delete(`encoding/inputs/gcs/invalid-id`) - if err == nil { - t.Fatal("Expected to receive error - got nil") - } - if err.Error() != "ERROR 1001: Input with the given id was not found in our system" { - t.Fatalf("Expected error message - got %s", err.Error()) - } -} - -func stringToPtr(s string) *string { - return &s -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/h264_codec_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/h264_codec_configuration_service.go deleted file mode 100644 index 7ab9e4af..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/h264_codec_configuration_service.go +++ /dev/null @@ -1,94 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type H264CodecConfigurationService struct { - RestService *RestService -} - -const ( - H264CodecConfigurationEndpoint string = "encoding/configurations/video/h264" -) - -func NewH264CodecConfigurationService(bitmovin *bitmovin.Bitmovin) *H264CodecConfigurationService { - r := NewRestService(bitmovin) - - return &H264CodecConfigurationService{RestService: r} -} - -func (s *H264CodecConfigurationService) Create(a *models.H264CodecConfiguration) (*models.H264CodecConfigurationResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(H264CodecConfigurationEndpoint, b) - if err != nil { - return nil, err - } - var r models.H264CodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H264CodecConfigurationService) Retrieve(id string) (*models.H264CodecConfigurationResponse, error) { - path := H264CodecConfigurationEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.H264CodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H264CodecConfigurationService) Delete(id string) (*models.H264CodecConfigurationResponse, error) { - path := H264CodecConfigurationEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.H264CodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H264CodecConfigurationService) List(offset int64, limit int64) (*models.H264CodecConfigurationListResponse, error) { - o, err := s.RestService.List(H264CodecConfigurationEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.H264CodecConfigurationListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H264CodecConfigurationService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := H264CodecConfigurationEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/h265_codec_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/h265_codec_configuration_service.go deleted file mode 100644 index 3d56c0d8..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/h265_codec_configuration_service.go +++ /dev/null @@ -1,94 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type H265CodecConfigurationService struct { - RestService *RestService -} - -const ( - H265CodecConfigurationEndpoint string = "encoding/configurations/video/h265" -) - -func NewH265CodecConfigurationService(bitmovin *bitmovin.Bitmovin) *H265CodecConfigurationService { - r := NewRestService(bitmovin) - - return &H265CodecConfigurationService{RestService: r} -} - -func (s *H265CodecConfigurationService) Create(a *models.H265CodecConfiguration) (*models.H265CodecConfigurationResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(H265CodecConfigurationEndpoint, b) - if err != nil { - return nil, err - } - var r models.H265CodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H265CodecConfigurationService) Retrieve(id string) (*models.H265CodecConfigurationResponse, error) { - path := H265CodecConfigurationEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.H265CodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H265CodecConfigurationService) Delete(id string) (*models.H265CodecConfigurationResponse, error) { - path := H265CodecConfigurationEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.H265CodecConfigurationResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H265CodecConfigurationService) List(offset int64, limit int64) (*models.H265CodecConfigurationListResponse, error) { - o, err := s.RestService.List(H265CodecConfigurationEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.H265CodecConfigurationListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *H265CodecConfigurationService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := H265CodecConfigurationEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/hls_manifest_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/hls_manifest_service.go deleted file mode 100644 index b32d46b1..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/hls_manifest_service.go +++ /dev/null @@ -1,132 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type HLSManifestService struct { - RestService *RestService -} - -const ( - HLSManifestEndpoint string = "encoding/manifests/hls" -) - -func NewHLSManifestService(bitmovin *bitmovin.Bitmovin) *HLSManifestService { - r := NewRestService(bitmovin) - - return &HLSManifestService{RestService: r} -} - -func (s *HLSManifestService) Create(a *models.HLSManifest) (*models.HLSManifestResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - - o, err := s.RestService.Create(HLSManifestEndpoint, b) - if err != nil { - return nil, err - } - var r models.HLSManifestResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HLSManifestService) Retrieve(id string) (*models.HLSManifestResponse, error) { - path := HLSManifestEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.HLSManifestResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HLSManifestService) Delete(id string) (*models.HLSManifestResponse, error) { - path := HLSManifestEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.HLSManifestResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HLSManifestService) AddMediaInfo(manifestID string, a *models.MediaInfo) (*models.MediaInfoResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := HLSManifestEndpoint + "/" + manifestID + "/media" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.MediaInfoResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HLSManifestService) AddStreamInfo(manifestID string, a *models.StreamInfo) (*models.StreamInfoResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - path := HLSManifestEndpoint + "/" + manifestID + "/streams" - o, err := s.RestService.Create(path, b) - if err != nil { - return nil, err - } - var r models.StreamInfoResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HLSManifestService) Start(manifestID string) (*models.StartStopResponse, error) { - path := HLSManifestEndpoint + "/" + manifestID + "/start" - o, err := s.RestService.Create(path, nil) - if err != nil { - return nil, err - } - var r models.StartStopResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HLSManifestService) RetrieveStatus(manifestID string) (*models.StatusResponse, error) { - path := HLSManifestEndpoint + "/" + manifestID + "/status" - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.StatusResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/http_input_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/http_input_configuration_service.go deleted file mode 100644 index 1c2fa103..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/http_input_configuration_service.go +++ /dev/null @@ -1,94 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type HTTPInputService struct { - RestService *RestService -} - -const ( - HTTPInputEndpoint string = "encoding/inputs/http" -) - -func NewHTTPInputService(bitmovin *bitmovin.Bitmovin) *HTTPInputService { - r := NewRestService(bitmovin) - - return &HTTPInputService{RestService: r} -} - -func (s *HTTPInputService) Create(a *models.HTTPInput) (*models.HTTPInputResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(HTTPInputEndpoint, b) - if err != nil { - return nil, err - } - var r models.HTTPInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPInputService) Retrieve(id string) (*models.HTTPInputResponse, error) { - path := HTTPInputEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.HTTPInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPInputService) Delete(id string) (*models.HTTPInputResponse, error) { - path := HTTPInputEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.HTTPInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPInputService) List(offset int64, limit int64) (*models.HTTPInputListResponse, error) { - o, err := s.RestService.List(HTTPInputEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.HTTPInputListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPInputService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := HTTPInputEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/https_input_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/https_input_configuration_service.go deleted file mode 100644 index 0c48d0ba..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/https_input_configuration_service.go +++ /dev/null @@ -1,95 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type HTTPSInputService struct { - RestService *RestService -} - -const ( - HTTPSInputEndpoint string = "encoding/inputs/https" -) - -func NewHTTPSInputService(bitmovin *bitmovin.Bitmovin) *HTTPSInputService { - r := NewRestService(bitmovin) - - return &HTTPSInputService{RestService: r} -} - -func (s *HTTPSInputService) Create(a *models.HTTPSInput) (*models.HTTPSInputResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - // fmt.Println(string(b)) - o, err := s.RestService.Create(HTTPSInputEndpoint, b) - if err != nil { - return nil, err - } - var r models.HTTPSInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPSInputService) Retrieve(id string) (*models.HTTPSInputResponse, error) { - path := HTTPSInputEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.HTTPSInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPSInputService) Delete(id string) (*models.HTTPSInputResponse, error) { - path := HTTPSInputEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.HTTPSInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPSInputService) List(offset int64, limit int64) (*models.HTTPSInputListResponse, error) { - o, err := s.RestService.List(HTTPSInputEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.HTTPSInputListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *HTTPSInputService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := HTTPSInputEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/infrastructure_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/infrastructure_service.go deleted file mode 100644 index 36a28238..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/infrastructure_service.go +++ /dev/null @@ -1,66 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type InfrastructureService struct { - RestService *RestService -} - -const ( - InfrastructureEndpoint string = "encoding/infrastructure/kubernetes" -) - -func NewInfrastructureService(bitmovin *bitmovin.Bitmovin) *InfrastructureService { - r := NewRestService(bitmovin) - return &InfrastructureService{RestService: r} -} - -func (s *InfrastructureService) Create(i *models.CreateInfrastructureRequest) (*models.InfrastructureDetail, error) { - b, err := json.Marshal(*i) - if err != nil { - return nil, err - } - responseBody, err := s.RestService.Create(InfrastructureEndpoint, b) - if err != nil { - return nil, err - } - - return MarshalSingleResponse(responseBody) -} - -func (s *InfrastructureService) Retrieve(id string) (*models.InfrastructureDetail, error) { - path := InfrastructureEndpoint + "/" + id - - responseBody, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - return MarshalSingleResponse(responseBody) -} - -func (s *InfrastructureService) List(offset int64, limit int64) (*[]models.InfrastructureDetail, error) { - o, err := s.RestService.List(InfrastructureEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.InfrastructureListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r.Data.Result.Items, nil -} - -func MarshalSingleResponse(responseString []byte) (*models.InfrastructureDetail, error) { - var responseValue models.InfrastructureResponse - err := json.Unmarshal(responseString, &responseValue) - if err != nil { - return nil, err - } - return &responseValue.Data.Result, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/package.go b/vendor/github.com/bitmovin/bitmovin-go/services/package.go deleted file mode 100644 index 633dd066..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/package.go +++ /dev/null @@ -1,6 +0,0 @@ -package services - -const ( - ClientName string = "bitmovin-go" - Version string = "1.1.0" -) diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/rest_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/rest_service.go deleted file mode 100644 index 94e0a9c3..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/rest_service.go +++ /dev/null @@ -1,178 +0,0 @@ -package services - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "net/http" - "net/url" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type RestService struct { - Bitmovin *bitmovin.Bitmovin -} - -func NewRestService(bitmovin *bitmovin.Bitmovin) *RestService { - return &RestService{ - Bitmovin: bitmovin, - } -} - -func (r *RestService) Create(relativeURL string, input []byte) ([]byte, error) { - fullURL := *r.Bitmovin.APIBaseURL + relativeURL - _, err := url.Parse(fullURL) - if err != nil { - return nil, err - } - req, err := http.NewRequest("POST", fullURL, bytes.NewBuffer(input)) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("X-Api-Key", *r.Bitmovin.APIKey) - req.Header.Set("X-Api-Client", ClientName) - req.Header.Set("X-Api-Client-Version", Version) - - resp, err := r.Bitmovin.HTTPClient.Do(req) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - if resp.StatusCode > 399 { - return nil, formatError(body) - } - - return body, nil -} - -func (r *RestService) Retrieve(relativeURL string) ([]byte, error) { - fullURL := *r.Bitmovin.APIBaseURL + relativeURL - _, err := url.Parse(fullURL) - if err != nil { - return nil, err - } - req, err := http.NewRequest("GET", fullURL, nil) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("X-Api-Key", *r.Bitmovin.APIKey) - req.Header.Set("X-Api-Client", ClientName) - req.Header.Set("X-Api-Client-Version", Version) - - resp, err := r.Bitmovin.HTTPClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - if resp.StatusCode > 399 { - return nil, formatError(body) - } - - return body, nil -} - -func (r *RestService) Delete(relativeURL string) ([]byte, error) { - fullURL := *r.Bitmovin.APIBaseURL + relativeURL - _, err := url.Parse(fullURL) - if err != nil { - return nil, err - } - req, err := http.NewRequest("DELETE", fullURL, nil) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("X-Api-Key", *r.Bitmovin.APIKey) - req.Header.Set("X-Api-Client", ClientName) - req.Header.Set("X-Api-Client-Version", Version) - - resp, err := r.Bitmovin.HTTPClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - if resp.StatusCode > 399 { - return nil, formatError(body) - } - - return body, nil -} - -//TODO default value version -func (r *RestService) List(relativeURL string, offset int64, limit int64) ([]byte, error) { - queryParams := fmt.Sprintf("?offset=%v&limit=%v", offset, limit) - fullURL := *r.Bitmovin.APIBaseURL + relativeURL + queryParams - - req, err := http.NewRequest("GET", fullURL, nil) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("X-Api-Key", *r.Bitmovin.APIKey) - req.Header.Set("X-Api-Client", ClientName) - req.Header.Set("X-Api-Client-Version", Version) - - resp, err := r.Bitmovin.HTTPClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - return body, nil -} - -func (r *RestService) RetrieveCustomData(relativeURL string) ([]byte, error) { - fullURL := *r.Bitmovin.APIBaseURL + relativeURL + "/customData" - _, err := url.Parse(fullURL) - if err != nil { - return nil, err - } - req, err := http.NewRequest("GET", fullURL, nil) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("X-Api-Key", *r.Bitmovin.APIKey) - req.Header.Set("X-Api-Client", ClientName) - req.Header.Set("X-Api-Client-Version", Version) - - resp, err := r.Bitmovin.HTTPClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - return body, nil -} - -func unmarshalError(body []byte) (*models.DataEnvelope, error) { - var d models.DataEnvelope - err := json.Unmarshal(body, &d) - if err != nil { - return nil, err - } - return &d, nil -} - -func formatError(body []byte) error { - data, err := unmarshalError(body) - if err != nil { - return err - } - str := fmt.Sprintf("%s %d (ReqId#%s): %s", data.Status, data.Data.Code, data.RequestID, data.Data.Message) - return errors.New(str) -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/rtmp_input_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/rtmp_input_configuration_service.go deleted file mode 100644 index b0c5befb..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/rtmp_input_configuration_service.go +++ /dev/null @@ -1,49 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type RTMPInputService struct { - RestService *RestService -} - -const ( - RTMPInputEndpoint string = "encoding/inputs/rtmp" -) - -func NewRTMPInputService(bitmovin *bitmovin.Bitmovin) *RTMPInputService { - r := NewRestService(bitmovin) - - return &RTMPInputService{RestService: r} -} - -func (s *RTMPInputService) Retrieve(id string) (*models.RTMPInputResponse, error) { - path := RTMPInputEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.RTMPInputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *RTMPInputService) List(offset int64, limit int64) (*models.RTMPInputListResponse, error) { - o, err := s.RestService.List(RTMPInputEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.RTMPInputListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/s3_input_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/s3_input_configuration_service.go deleted file mode 100644 index a9ea5ea5..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/s3_input_configuration_service.go +++ /dev/null @@ -1,94 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type S3InputService struct { - RestService *RestService -} - -const ( - S3InputEndpoint string = "encoding/inputs/s3" -) - -func NewS3InputService(bitmovin *bitmovin.Bitmovin) *S3InputService { - r := NewRestService(bitmovin) - - return &S3InputService{RestService: r} -} - -func (s *S3InputService) Create(a *models.S3Input) (*models.S3InputResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(S3InputEndpoint, b) - if err != nil { - return nil, err - } - var r models.S3InputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3InputService) Retrieve(id string) (*models.S3InputResponse, error) { - path := S3InputEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.S3InputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3InputService) Delete(id string) (*models.S3InputResponse, error) { - path := S3InputEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.S3InputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3InputService) List(offset int64, limit int64) (*models.S3InputListResponse, error) { - o, err := s.RestService.List(S3InputEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.S3InputListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3InputService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := S3InputEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/bitmovin/bitmovin-go/services/s3_output_configuration_service.go b/vendor/github.com/bitmovin/bitmovin-go/services/s3_output_configuration_service.go deleted file mode 100644 index f425d83e..00000000 --- a/vendor/github.com/bitmovin/bitmovin-go/services/s3_output_configuration_service.go +++ /dev/null @@ -1,94 +0,0 @@ -package services - -import ( - "encoding/json" - - "github.com/bitmovin/bitmovin-go/bitmovin" - "github.com/bitmovin/bitmovin-go/models" -) - -type S3OutputService struct { - RestService *RestService -} - -const ( - S3OutputEndpoint string = "encoding/outputs/s3" -) - -func NewS3OutputService(bitmovin *bitmovin.Bitmovin) *S3OutputService { - r := NewRestService(bitmovin) - - return &S3OutputService{RestService: r} -} - -func (s *S3OutputService) Create(a *models.S3Output) (*models.S3OutputResponse, error) { - b, err := json.Marshal(*a) - if err != nil { - return nil, err - } - o, err := s.RestService.Create(S3OutputEndpoint, b) - if err != nil { - return nil, err - } - var r models.S3OutputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3OutputService) Retrieve(id string) (*models.S3OutputResponse, error) { - path := S3OutputEndpoint + "/" + id - o, err := s.RestService.Retrieve(path) - if err != nil { - return nil, err - } - var r models.S3OutputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3OutputService) Delete(id string) (*models.S3OutputResponse, error) { - path := S3OutputEndpoint + "/" + id - o, err := s.RestService.Delete(path) - if err != nil { - return nil, err - } - var r models.S3OutputResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3OutputService) List(offset int64, limit int64) (*models.S3OutputListResponse, error) { - o, err := s.RestService.List(S3OutputEndpoint, offset, limit) - if err != nil { - return nil, err - } - var r models.S3OutputListResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} - -func (s *S3OutputService) RetrieveCustomData(id string) (*models.CustomDataResponse, error) { - path := S3OutputEndpoint + "/" + id - o, err := s.RestService.RetrieveCustomData(path) - if err != nil { - return nil, err - } - var r models.CustomDataResponse - err = json.Unmarshal(o, &r) - if err != nil { - return nil, err - } - return &r, nil -} diff --git a/vendor/github.com/facebookgo/stack/.travis.yml b/vendor/github.com/facebookgo/stack/.travis.yml deleted file mode 100644 index 4938b453..00000000 --- a/vendor/github.com/facebookgo/stack/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: go - -go: - - 1.3 - -matrix: - fast_finish: true - -before_install: - - if ! go get code.google.com/p/go.tools/cmd/vet; then go get golang.org/x/tools/cmd/vet; fi - - go get -v github.com/golang/lint/golint - - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi - -install: - - go install -race -v std - - go get -race -t -v ./... - - go install -race -v ./... - -script: - - go vet ./... - - $HOME/gopath/bin/golint . - - go test -cpu=2 -race -v ./... - - go test -cpu=2 -covermode=atomic ./... diff --git a/vendor/github.com/facebookgo/stack/bench_test.go b/vendor/github.com/facebookgo/stack/bench_test.go deleted file mode 100644 index b966bee0..00000000 --- a/vendor/github.com/facebookgo/stack/bench_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package stack_test - -import ( - "fmt" - "runtime" - "sync" - "testing" - - "github.com/facebookgo/stack" -) - -func BenchmarkCallersMulti(b *testing.B) { - for i := 0; i < b.N; i++ { - stack.CallersMulti(0) - } -} - -func BenchmarkCallers(b *testing.B) { - for i := 0; i < b.N; i++ { - stack.Callers(0) - } -} - -func BenchmarkCaller(b *testing.B) { - for i := 0; i < b.N; i++ { - stack.Caller(0) - } -} - -func BenchmarkRuntimeCallersReusePCS(b *testing.B) { - pcs := make([]uintptr, 32) - for i := 0; i < b.N; i++ { - runtime.Callers(0, pcs) - } -} - -func BenchmarkRuntimeCallersMakePCS(b *testing.B) { - for i := 0; i < b.N; i++ { - pcs := make([]uintptr, 32) - runtime.Callers(0, pcs) - } -} - -func BenchmarkRuntimeCallersFixedPCS(b *testing.B) { - for i := 0; i < b.N; i++ { - var pcs [32]uintptr - runtime.Callers(0, pcs[:]) - } -} - -func BenchmarkRuntimeCallersSyncPool(b *testing.B) { - pool := sync.Pool{New: func() interface{} { return make([]uintptr, 32) }} - for i := 0; i < b.N; i++ { - pcs := pool.Get().([]uintptr) - runtime.Callers(0, pcs[:]) - pcs = pcs[0:] - pool.Put(pcs) - } -} - -func BenchmarkSprintf(b *testing.B) { - for i := 0; i < b.N; i++ { - fmt.Sprintf("hello") - } -} diff --git a/vendor/github.com/facebookgo/stack/license b/vendor/github.com/facebookgo/stack/license deleted file mode 100644 index f55fc8af..00000000 --- a/vendor/github.com/facebookgo/stack/license +++ /dev/null @@ -1,30 +0,0 @@ -BSD License - -For stack software - -Copyright (c) 2015, Facebook, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name Facebook nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/facebookgo/stack/patents b/vendor/github.com/facebookgo/stack/patents deleted file mode 100644 index 711e9e68..00000000 --- a/vendor/github.com/facebookgo/stack/patents +++ /dev/null @@ -1,33 +0,0 @@ -Additional Grant of Patent Rights Version 2 - -"Software" means the stack software distributed by Facebook, Inc. - -Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software -("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable -(subject to the termination provision below) license under any Necessary -Claims, to make, have made, use, sell, offer to sell, import, and otherwise -transfer the Software. For avoidance of doubt, no license is granted under -Facebook’s rights in any patent claims that are infringed by (i) modifications -to the Software made by you or any third party or (ii) the Software in -combination with any software or other technology. - -The license granted hereunder will terminate, automatically and without notice, -if you (or any of your subsidiaries, corporate affiliates or agents) initiate -directly or indirectly, or take a direct financial interest in, any Patent -Assertion: (i) against Facebook or any of its subsidiaries or corporate -affiliates, (ii) against any party if such Patent Assertion arises in whole or -in part from any software, technology, product or service of Facebook or any of -its subsidiaries or corporate affiliates, or (iii) against any party relating -to the Software. Notwithstanding the foregoing, if Facebook or any of its -subsidiaries or corporate affiliates files a lawsuit alleging patent -infringement against you in the first instance, and you respond by filing a -patent infringement counterclaim in that lawsuit against that party that is -unrelated to the Software, the license granted hereunder will not terminate -under section (i) of this paragraph due to such counterclaim. - -A "Necessary Claim" is a claim of a patent owned by Facebook that is -necessarily infringed by the Software standing alone. - -A "Patent Assertion" is any lawsuit or other action alleging direct, indirect, -or contributory infringement or inducement to infringe any patent, including a -cross-claim or counterclaim. diff --git a/vendor/github.com/facebookgo/stack/readme.md b/vendor/github.com/facebookgo/stack/readme.md deleted file mode 100644 index e6db95c8..00000000 --- a/vendor/github.com/facebookgo/stack/readme.md +++ /dev/null @@ -1,142 +0,0 @@ -# stack --- - import "github.com/facebookgo/stack" - -Package stack provides utilities to capture and pass around stack traces. - -This is useful for building errors that know where they originated from, to -track where a certain log event occured and so on. - -The package provides stack.Multi which represents a sequence of stack traces. -Since in Go we return errors they don't necessarily end up with a single useful -stack trace. For example an error may be going thru a channel across goroutines, -in which case we may want to capture a stack trace in both (or many) goroutines. -stack.Multi in turn is made up of stack.Stack, which is a set of stack.Frames. -Each stack.Frame contains the File/Line/Name (function name). All these types -implement a pretty human readable String() function. - -The GOPATH is stripped from the File location. Look at the StripGOPATH function -on instructions for how to embed to GOPATH into the binary for when deploying to -production and the GOPATH environment variable may not be set. The package name -is stripped from the Name of the function since it included in the File -location. - -## Usage - -#### func StripGOPATH - -```go -func StripGOPATH(f string) string -``` -StripGOPATH strips the GOPATH prefix from the file path f. In development, this -will be done using the GOPATH environment variable. For production builds, where -the GOPATH environment will not be set, the GOPATH can be included in the binary -by passing ldflags, for example: - - GO_LDFLAGS="$GO_LDFLAGS -X github.com/facebookgo/stack.gopath $GOPATH" - go install "-ldflags=$GO_LDFLAGS" my/pkg - -#### func StripPackage - -```go -func StripPackage(n string) string -``` -StripPackage strips the package name from the given Func.Name. - -#### type Frame - -```go -type Frame struct { - File string - Line int - Name string -} -``` - -Frame identifies a file, line & function name in the stack. - -#### func Caller - -```go -func Caller(skip int) Frame -``` -Caller returns a single Frame for the caller. The argument skip is the number of -stack frames to ascend, with 0 identifying the caller of Callers. - -#### func (Frame) String - -```go -func (f Frame) String() string -``` -String provides the standard file:line representation. - -#### type Multi - -```go -type Multi struct { -} -``` - -Multi represents a number of Stacks. This is useful to allow tracking a value as -it travels thru code. - -#### func CallersMulti - -```go -func CallersMulti(skip int) *Multi -``` -CallersMulti returns a Multi which includes one Stack for the current callers. -The argument skip is the number of stack frames to ascend, with 0 identifying -the caller of CallersMulti. - -#### func (*Multi) Add - -```go -func (m *Multi) Add(s Stack) -``` -Add the given Stack to this Multi. - -#### func (*Multi) AddCallers - -```go -func (m *Multi) AddCallers(skip int) -``` -AddCallers adds the Callers Stack to this Multi. The argument skip is the number -of stack frames to ascend, with 0 identifying the caller of Callers. - -#### func (*Multi) Stacks - -```go -func (m *Multi) Stacks() []Stack -``` -Stacks returns the tracked Stacks. - -#### func (*Multi) String - -```go -func (m *Multi) String() string -``` -String provides a human readable multi-line stack trace. - -#### type Stack - -```go -type Stack []Frame -``` - -Stack represents an ordered set of Frames. - -#### func Callers - -```go -func Callers(skip int) Stack -``` -Callers returns a Stack of Frames for the callers. The argument skip is the -number of stack frames to ascend, with 0 identifying the caller of Callers. - -#### func (Stack) String - -```go -func (s Stack) String() string -``` -String provides the standard multi-line stack trace. diff --git a/vendor/github.com/facebookgo/stack/stack.go b/vendor/github.com/facebookgo/stack/stack.go deleted file mode 100644 index fb2a6cbf..00000000 --- a/vendor/github.com/facebookgo/stack/stack.go +++ /dev/null @@ -1,230 +0,0 @@ -// Package stack provides utilities to capture and pass around stack traces. -// -// This is useful for building errors that know where they originated from, to -// track where a certain log event occured and so on. -// -// The package provides stack.Multi which represents a sequence of stack -// traces. Since in Go we return errors they don't necessarily end up with a -// single useful stack trace. For example an error may be going thru a channel -// across goroutines, in which case we may want to capture a stack trace in -// both (or many) goroutines. stack.Multi in turn is made up of stack.Stack, -// which is a set of stack.Frames. Each stack.Frame contains the File/Line/Name -// (function name). All these types implement a pretty human readable String() -// function. -// -// The GOPATH is stripped from the File location. Look at the StripGOPATH -// function on instructions for how to embed to GOPATH into the binary for when -// deploying to production and the GOPATH environment variable may not be set. -// The package name is stripped from the Name of the function since it included -// in the File location. -package stack - -import ( - "bytes" - "fmt" - "os" - "path/filepath" - "runtime" - "strings" -) - -const maxStackSize = 32 - -// Frame identifies a file, line & function name in the stack. -type Frame struct { - File string - Line int - Name string -} - -// String provides the standard file:line representation. -func (f Frame) String() string { - return fmt.Sprintf("%s:%d %s", f.File, f.Line, f.Name) -} - -// Stack represents an ordered set of Frames. -type Stack []Frame - -// String provides the standard multi-line stack trace. -func (s Stack) String() string { - var b bytes.Buffer - writeStack(&b, s) - return b.String() -} - -// Multi represents a number of Stacks. This is useful to allow tracking a -// value as it travels thru code. -type Multi struct { - stacks []Stack -} - -// Stacks returns the tracked Stacks. -func (m *Multi) Stacks() []Stack { - return m.stacks -} - -// Add the given Stack to this Multi. -func (m *Multi) Add(s Stack) { - m.stacks = append(m.stacks, s) -} - -// AddCallers adds the Callers Stack to this Multi. The argument skip is -// the number of stack frames to ascend, with 0 identifying the caller of -// Callers. -func (m *Multi) AddCallers(skip int) { - m.Add(Callers(skip + 1)) -} - -// String provides a human readable multi-line stack trace. -func (m *Multi) String() string { - var b bytes.Buffer - for i, s := range m.stacks { - if i != 0 { - fmt.Fprintf(&b, "\n(Stack %d)\n", i+1) - } - writeStack(&b, s) - } - return b.String() -} - -// Copy makes a copy of the stack which is safe to modify. -func (m *Multi) Copy() *Multi { - m2 := &Multi{ - stacks: make([]Stack, len(m.stacks)), - } - copy(m2.stacks, m.stacks) - return m2 -} - -// Caller returns a single Frame for the caller. The argument skip is the -// number of stack frames to ascend, with 0 identifying the caller of Callers. -func Caller(skip int) Frame { - pc, file, line, _ := runtime.Caller(skip + 1) - fun := runtime.FuncForPC(pc) - return Frame{ - File: StripGOPATH(file), - Line: line, - Name: StripPackage(fun.Name()), - } -} - -// Callers returns a Stack of Frames for the callers. The argument skip is the -// number of stack frames to ascend, with 0 identifying the caller of Callers. -func Callers(skip int) Stack { - pcs := make([]uintptr, maxStackSize) - num := runtime.Callers(skip+2, pcs) - stack := make(Stack, num) - for i, pc := range pcs[:num] { - fun := runtime.FuncForPC(pc) - file, line := fun.FileLine(pc - 1) - stack[i].File = StripGOPATH(file) - stack[i].Line = line - stack[i].Name = StripPackage(fun.Name()) - } - return stack -} - -// CallersMulti returns a Multi which includes one Stack for the -// current callers. The argument skip is the number of stack frames to ascend, -// with 0 identifying the caller of CallersMulti. -func CallersMulti(skip int) *Multi { - m := new(Multi) - m.AddCallers(skip + 1) - return m -} - -func writeStack(b *bytes.Buffer, s Stack) { - var width int - for _, f := range s { - if l := len(f.File) + numDigits(f.Line) + 1; l > width { - width = l - } - } - last := len(s) - 1 - for i, f := range s { - b.WriteString(f.File) - b.WriteRune(rune(':')) - n, _ := fmt.Fprintf(b, "%d", f.Line) - for i := width - len(f.File) - n; i != 0; i-- { - b.WriteRune(rune(' ')) - } - b.WriteString(f.Name) - if i != last { - b.WriteRune(rune('\n')) - } - } -} - -func numDigits(i int) int { - var n int - for { - n++ - i = i / 10 - if i == 0 { - return n - } - } -} - -var ( - // This can be set by a build script. It will be the colon separated equivalent - // of the environment variable. - gopath string - - // This is the processed version based on either the above variable set by the - // build or from the GOPATH environment variable. - gopaths []string -) - -func init() { - // prefer the variable set at build time, otherwise fallback to the - // environment variable. - if gopath == "" { - gopath = os.Getenv("GOPATH") - } - SetGOPATH(gopath) -} - -// StripGOPATH strips the GOPATH prefix from the file path f. -// In development, this will be done using the GOPATH environment variable. -// For production builds, where the GOPATH environment will not be set, the -// GOPATH can be included in the binary by passing ldflags, for example: -// -// GO_LDFLAGS="$GO_LDFLAGS -X github.com/facebookgo/stack.gopath $GOPATH" -// go install "-ldflags=$GO_LDFLAGS" my/pkg -func StripGOPATH(f string) string { - for _, p := range gopaths { - if strings.HasPrefix(f, p) { - return f[len(p):] - } - } - return f -} - -// SetGOPATH configures the GOPATH to enable relative paths in stack traces. -func SetGOPATH(gp string) { - gopath = gp - gopaths = nil - - for _, p := range strings.Split(gopath, ":") { - if p != "" { - gopaths = append(gopaths, filepath.Join(p, "src")+"/") - } - } - - // Also strip GOROOT for maximum cleanliness - gopaths = append(gopaths, filepath.Join(runtime.GOROOT(), "src", "pkg")+"/") -} - -// StripPackage strips the package name from the given Func.Name. -func StripPackage(n string) string { - slashI := strings.LastIndex(n, "/") - if slashI == -1 { - slashI = 0 // for built-in packages - } - dotI := strings.Index(n[slashI:], ".") - if dotI == -1 { - return n - } - return n[slashI+dotI+1:] -} diff --git a/vendor/github.com/facebookgo/stack/stack_test.go b/vendor/github.com/facebookgo/stack/stack_test.go deleted file mode 100644 index 38e3af4c..00000000 --- a/vendor/github.com/facebookgo/stack/stack_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package stack_test - -import ( - "regexp" - "strings" - "testing" - - "github.com/facebookgo/stack" -) - -func indirect1() stack.Stack { - return stack.Callers(0) -} - -func indirect2() stack.Stack { - return indirect1() -} - -func indirect3() stack.Stack { - return indirect2() -} - -func TestCallers(t *testing.T) { - s := indirect3() - matches := []string{ - "stack_test.go:12 +indirect1$", - "stack_test.go:16 +indirect2$", - "stack_test.go:20 +indirect3$", - "stack_test.go:24 +TestCallers$", - } - match(t, s.String(), matches) -} - -func TestCallersMulti(t *testing.T) { - m := stack.CallersMulti(0) - const expected = "stack_test.go:35 TestCallersMulti" - first := m.Stacks()[0][0].String() - if !strings.HasSuffix(first, expected) { - t.Fatalf(`expected suffix "%s" got "%s"`, expected, first) - } -} - -func TestCallersMultiWithTwo(t *testing.T) { - m := stack.CallersMulti(0) - m.AddCallers(0) - matches := []string{ - "stack_test.go:44 +TestCallersMultiWithTwo$", - "", - "", - `\(Stack 2\)$`, - "stack_test.go:45 +TestCallersMultiWithTwo$", - } - match(t, m.String(), matches) -} - -type typ struct{} - -func (m typ) indirect1() stack.Stack { - return stack.Callers(0) -} - -func (m typ) indirect2() stack.Stack { - return m.indirect1() -} - -func (m typ) indirect3() stack.Stack { - return m.indirect2() -} - -func TestCallersWithStruct(t *testing.T) { - var m typ - s := m.indirect3() - matches := []string{ - "stack_test.go:59 +typ.indirect1$", - "stack_test.go:63 +typ.indirect2$", - "stack_test.go:67 +typ.indirect3$", - "stack_test.go:72 +TestCallersWithStruct$", - } - match(t, s.String(), matches) -} - -func TestCaller(t *testing.T) { - f := stack.Caller(0) - const expected = "stack_test.go:83 TestCaller" - if !strings.HasSuffix(f.String(), expected) { - t.Fatalf(`expected suffix "%s" got "%s"`, expected, f) - } -} - -func match(t testing.TB, s string, matches []string) { - lines := strings.Split(s, "\n") - for i, m := range matches { - if !regexp.MustCompile(m).MatchString(lines[i]) { - t.Fatalf( - "did not find expected match \"%s\" on line %d in:\n%s", - m, - i, - s, - ) - } - } -} diff --git a/vendor/github.com/flavioribeiro/zencoder/.gitignore b/vendor/github.com/flavioribeiro/zencoder/.gitignore deleted file mode 100644 index 00268614..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/vendor/github.com/flavioribeiro/zencoder/.travis.yml b/vendor/github.com/flavioribeiro/zencoder/.travis.yml deleted file mode 100644 index f86e4114..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go - -go: -- 1.2 - -install: cat BUILD_DEPENDENCIES | xargs -I{} go get -v {} - -script: $HOME/gopath/bin/goveralls -v $GOVERALLS - -env: - global: - secure: FNiT1iwL+7PQwwZRwvnJGu7Wxy2sFv3b3AKecx41OoegGCTWL0R64ftrLvARuV85ZiMvT39NB8SZr7ojO9tcQeVeC6CpGuwuadBXp+kCvh1yUsZZvTI/f/I9LokT8xp/VQVJTZVasXZ/20C2lZkspyaFN36cHnPHIoLB6bKSO2w= diff --git a/vendor/github.com/flavioribeiro/zencoder/AUTHORS b/vendor/github.com/flavioribeiro/zencoder/AUTHORS deleted file mode 100644 index 7fe0a8cf..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/AUTHORS +++ /dev/null @@ -1,17 +0,0 @@ -# This is the official list of (go)zencoder authors for copyright purposes. - -# If you are submitting a patch, please add your name or the name of the -# organization which holds the copyright to this list in alphabetical order. - -# Names should be added to this file as -# Name -# The email address is not required for organizations. -# Please keep the list sorted. - -# Individual Persons - -Seth Yates - -# Organizations - -Brandscreen Pty Ltd \ No newline at end of file diff --git a/vendor/github.com/flavioribeiro/zencoder/BUILD_DEPENDENCIES b/vendor/github.com/flavioribeiro/zencoder/BUILD_DEPENDENCIES deleted file mode 100644 index 14790c24..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/BUILD_DEPENDENCIES +++ /dev/null @@ -1,2 +0,0 @@ -github.com/sethyates/goveralls -code.google.com/p/go.tools/cmd/cover \ No newline at end of file diff --git a/vendor/github.com/flavioribeiro/zencoder/CONTRIBUTING.md b/vendor/github.com/flavioribeiro/zencoder/CONTRIBUTING.md deleted file mode 100644 index 6eb116b9..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -# Contributing - -By contributing to this project, you share your code under the MIT License, as specified in the LICENSE file. Don't forget to add yourself to the AUTHORS file. - -## Getting Started - -* Make sure you have a GitHub account -* Submit a ticket for your issue, assuming one does not already exist. -* Clearly describe the issue including steps to reproduce when it is a bug. -* Make sure you fill in the earliest version that you know has the issue. - -## Making Changes - -* Fork the repository on GitHub. -* Make the changes to your forked repository. -* Ensure you stick to the Go formatting conventions (use go fmt). -* Ensure you use UNIX-style LF line endings. -* When committing, reference your issue (#1234) and include a note about the fix. -* Push the changes to your fork and submit a pull request on the master repository. -* At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary. - -## Pull Requests Checklist - -Please check the following points before submitting your pull request: - -[x] Code compiles correctly -[x] Created tests, if possible -[x] All tests pass -[x] Extended the README / documentation, if necessary -[x] Added yourself to the AUTHORS file, if not already there diff --git a/vendor/github.com/flavioribeiro/zencoder/LICENSE b/vendor/github.com/flavioribeiro/zencoder/LICENSE deleted file mode 100644 index ec367931..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Brandscreen Pty Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/flavioribeiro/zencoder/README.md b/vendor/github.com/flavioribeiro/zencoder/README.md deleted file mode 100644 index ec1e52f2..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/README.md +++ /dev/null @@ -1,181 +0,0 @@ -zencoder -======== - -[![Build Status](https://travis-ci.org/brandscreen/zencoder.png)](https://travis-ci.org/brandscreen/zencoder) [![Coverage Status](https://coveralls.io/repos/brandscreen/zencoder/badge.png?branch=HEAD)](https://coveralls.io/r/brandscreen/zencoder?branch=HEAD) - -[Go](http://golang.org) integration for [Zencoder API](http://www.zencoder.com/) video transcoding service. - -# Requirements - -* Go 1.1 or higher -* A Zencoder account/API key (get one at app.zencoder.com) - -# Documentation - -[Godoc](http://godoc.org/) documentation is available at [http://godoc.org/github.com/brandscreen/zencoder](http://godoc.org/github.com/brandscreen/zencoder). - -# Installation - -```bash -$ go get github.com/brandscreen/zencoder -``` - -# Usage - -## Import Zencoder - -Ensure you have imported the zencoder package at the top of your source file. - -```golang -import "github.com/brandscreen/zencoder" -``` - -## Create a connection to Zencoder - -All Zencoder methods are on the Zencoder struct. Create a new one bound to your API key using ```zencoder.NewZencoder```. - -```golang -// make sure you replace [YOUR API KEY HERE] with your API key -zc := zencoder.NewZencoder("[YOUR API KEY HERE]") -``` - -## [Jobs](https://app.zencoder.com/docs/api/jobs) - -### [Create a Job](https://app.zencoder.com/docs/api/jobs/create) -```golang -settings := &zencoder.EncodingSettings{ - Input: "s3://zencodertesting/test.mov", - Test: true, -} -job, err := zc.CreateJob(settings) -``` - -### [List Jobs](https://app.zencoder.com/docs/api/jobs/list) -```golang -jobs, err := zc.ListJobs() -``` - -### [Get Job Details](https://app.zencoder.com/docs/api/jobs/show) -```golang -details, err := zc.GetJobDetails(12345) -``` - -### [Job Progress](https://app.zencoder.com/docs/api/jobs/progress) -```golang -progress, err := zc.GetJobProgress(12345) -``` - -### [Resubmit a Job](https://app.zencoder.com/docs/api/jobs/resubmit) -```golang -err := zc.ResubmitJob(12345) -``` - -### [Cancel a Job](https://app.zencoder.com/docs/api/jobs/cancel) -```golang -err := zc.CancelJob(12345) -``` - -### [Finish a Live Job](https://app.zencoder.com/docs/api/jobs/finish) -```golang -err := zc.FinishLiveJob(12345) -``` - -## [Inputs](https://app.zencoder.com/docs/api/inputs) - -### [Get Input Details](https://app.zencoder.com/docs/api/inputs/show) -```golang -details, err := zc.GetInputDetails(12345) -``` - -### [Input Progress](https://app.zencoder.com/docs/api/inputs/progress) -```golang -progress, err := zc.GetInputProgress(12345) -``` - -## [Outputs](https://app.zencoder.com/docs/api/outputs) - -### [Get Output Details](https://app.zencoder.com/docs/api/outputs/show) -```golang -details, err := zc.GetOutputDetails(12345) -``` - -### [Output Progress](https://app.zencoder.com/docs/api/outputs/progress) -```golang -progress, err := zc.GetOutputProgress(12345) -``` - -## [Accounts](https://app.zencoder.com/docs/api/accounts) - -### [Get Account Details](https://app.zencoder.com/docs/api/accounts/show) -```golang -account, err := zc.GetAccount() -``` - -### [Set Integration Mode](https://app.zencoder.com/docs/api/accounts/integration) -```golang -err := zc.SetIntegrationMode() -``` - -### [Set Live Mode](https://app.zencoder.com/docs/api/accounts/integration) -```golang -err := zc.SetLiveMode() -``` - -## [Reports](https://app.zencoder.com/docs/api/reports) - -### ReportSettings - -All reporting interfaces take either ```nil``` or a ```ReportSettings``` object. - -Using ```nil``` denotes to use default settings. In this case, assume ```settings``` in the examples below is defined as: - -```golang -var settings *zencoder.ReportSettings = nil -``` - -A ```ReportSettings``` object can either be constructed manually as in: -```golang -var start, end time.Date -settings := &zencoder.ReportSettings{ - From: &start, - To: &end, - Grouping: "key", -} -``` - -Or, you can use a Fluent-style interface to build a ```ReportSettings``` object, as in: - -```golang -var start, end time.Date -settings := zencoder.ReportFrom(start).To(time).Grouping("key") -``` - -### [Get VOD Usage](https://app.zencoder.com/docs/api/reports/vod) - -```golang -usage, err := zc.GetVodUsage(settings) -``` - -### [Get Live Usage](https://app.zencoder.com/docs/api/reports/live) - -```golang -usage, err := zc.GetLiveUsage(settings) -``` - -### [Get Total Usage](https://app.zencoder.com/docs/api/reports/all) - -```golang -usage, err := zc.GetUsage(settings) -``` - -## Encoding Settings - -See [Zencoder API documentation](https://app.zencoder.com/docs/api/encoding) for all encoding settings available in zencoder.EncodingSettings. All settings are currently supported, with the main difference being the casing of the options to fit with Go naming conventions. - -# Contributing - -Please see [CONTRIBUTING.md](https://github.com/brandscreen/zencoder/blob/master/CONTRIBUTING.md). If you have a bugfix or new feature that you would like to contribute, please find or open an issue about it first. - -# License - -Licensed under the MIT License. diff --git a/vendor/github.com/flavioribeiro/zencoder/accounts.go b/vendor/github.com/flavioribeiro/zencoder/accounts.go deleted file mode 100644 index 5b5733c0..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/accounts.go +++ /dev/null @@ -1,64 +0,0 @@ -package zencoder - -type AccountDetails struct { - AccountState string `json:"account_state,omitempty"` - Plan string `json:"plan,omitempty"` - MinutesUsed int32 `json:"minutes_used,omitempty"` - MinutesIncluded int32 `json:"minutes_included,omitempty"` - BillingState string `json:"billing_state,omitempty"` - IntegrationMode bool `json:"integration_mode,omitempty"` -} - -type CreateAccountRequest struct { - Email string `json:"email,omitempty"` - TermsOfService string `json:"terms_of_service,omitempty"` - Password *string `json:"password,omitempty,omitempty"` - PasswordConfirmation *string `json:"password_confirmation,omitempty,omitempty"` -} - -type CreateAccountResponse struct { - ApiKey string `json:"api_key,omitempty"` - Password string `json:"password,omitempty"` -} - -// Create an account -func (z *Zencoder) CreateAccount(email, password string) (*CreateAccountResponse, error) { - request := &CreateAccountRequest{ - Email: email, - TermsOfService: "1", - } - - if len(password) > 0 { - request.Password = &password - request.PasswordConfirmation = &password - } - - var result CreateAccountResponse - - if err := z.post("account", request, &result); err != nil { - return nil, err - } - - return &result, nil -} - -// Get Account Details -func (z *Zencoder) GetAccount() (*AccountDetails, error) { - var details AccountDetails - - if err := z.getBody("account", &details); err != nil { - return nil, err - } - - return &details, nil -} - -// Set Integration Mode -func (z *Zencoder) SetIntegrationMode() error { - return z.putNoContent("account/integration") -} - -// Set Live Mode -func (z *Zencoder) SetLiveMode() error { - return z.putNoContent("account/live") -} diff --git a/vendor/github.com/flavioribeiro/zencoder/accounts_test.go b/vendor/github.com/flavioribeiro/zencoder/accounts_test.go deleted file mode 100644 index 5749d232..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/accounts_test.go +++ /dev/null @@ -1,276 +0,0 @@ -package zencoder - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - "testing" -) - -func TestSetIntegrationMode(t *testing.T) { - integrationMode := false - expectedStatus := http.StatusNoContent - - mux := http.NewServeMux() - mux.HandleFunc("/account/integration", func(w http.ResponseWriter, r *http.Request) { - integrationMode = !integrationMode - w.WriteHeader(expectedStatus) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - err := zc.SetIntegrationMode() - if err != nil { - t.Fatal("Expected no error", err) - } - - if !integrationMode { - t.Fatal("Expected integration mode to be set") - } - - expectedStatus = http.StatusInternalServerError - err = zc.SetIntegrationMode() - if err == nil { - t.Fatal("Expected error") - } - - srv.Close() - expectedStatus = http.StatusOK - err = zc.SetIntegrationMode() - if err == nil { - t.Fatal("Expected error") - } -} - -func TestSetLiveMode(t *testing.T) { - liveMode := false - expectedStatus := http.StatusNoContent - - mux := http.NewServeMux() - mux.HandleFunc("/account/live", func(w http.ResponseWriter, r *http.Request) { - liveMode = !liveMode - w.WriteHeader(expectedStatus) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - err := zc.SetLiveMode() - if err != nil { - t.Fatal("Expected no error", err) - } - - if !liveMode { - t.Fatal("Expected live mode to be set") - } - - expectedStatus = http.StatusInternalServerError - err = zc.SetLiveMode() - if err == nil { - t.Fatal("Expected error") - } - - srv.Close() - expectedStatus = http.StatusOK - err = zc.SetLiveMode() - if err == nil { - t.Fatal("Expected error") - } -} - -func TestCreateAccount(t *testing.T) { - expectedStatus := http.StatusOK - - mux := http.NewServeMux() - mux.HandleFunc("/account", func(w http.ResponseWriter, r *http.Request) { - defer r.Body.Close() - b, err := ioutil.ReadAll(r.Body) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - t.Fatal("Could not read body") - return - } - - var request CreateAccountRequest - err = json.Unmarshal(b, &request) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - t.Fatal("Could not unmarshal body") - return - } - - if len(request.Email) == 0 { - w.WriteHeader(http.StatusInternalServerError) - t.Fatal("Expected email") - return - } - - if request.TermsOfService != "1" { - w.WriteHeader(http.StatusInternalServerError) - t.Fatal("Expected terms accepted", request.TermsOfService) - return - } - - if request.Password != nil && request.PasswordConfirmation != nil && *request.Password != *request.PasswordConfirmation { - w.WriteHeader(http.StatusInternalServerError) - t.Fatal("Expected passwords to match") - return - } - - var response CreateAccountResponse - response.ApiKey = "a123afdaf23fa231245fadcbbb" - - if request.Password == nil { - response.Password = "generatedPassword" - } else { - response.Password = *request.Password - } - - encoder := json.NewEncoder(w) - - w.WriteHeader(expectedStatus) - err = encoder.Encode(&response) - if err != nil { - t.Fatal("Expected to marshal response", err) - return - } - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - resp, err := zc.CreateAccount("email@email.com", "password123") - if err != nil { - t.Fatal("Expected no error", err) - } - - if resp.ApiKey != "a123afdaf23fa231245fadcbbb" { - t.Fatal("Expected key to match but got", resp.ApiKey) - } - - if resp.Password != "password123" { - t.Fatal("Expected password to match but got", resp.Password) - } - - resp, err = zc.CreateAccount("email@email.com", "") - if err != nil { - t.Fatal("Expected no error", err) - } - - if resp.ApiKey != "a123afdaf23fa231245fadcbbb" { - t.Fatal("Expected key to match but got", resp.ApiKey) - } - - if resp.Password != "generatedPassword" { - t.Fatal("Expected password to match but got", resp.Password) - } - - expectedStatus = http.StatusConflict - resp, err = zc.CreateAccount("email@email.com", "password123") - if err == nil { - t.Fatal("Expected error") - } - - if resp != nil { - t.Fatal("Expected no account") - } - - srv.Close() - expectedStatus = http.StatusOK - resp, err = zc.CreateAccount("email@email.com", "password123") - if err == nil { - t.Fatal("Expected error") - } - - if resp != nil { - t.Fatal("Expected no account") - } -} - -func TestGetAccount(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/account", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(expectedStatus) - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "account_state": "active", - "plan": "Growth", - "minutes_used": 12549, - "minutes_included": 25000, - "billing_state": "active", - "integration_mode":true -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - acct, err := zc.GetAccount() - if err != nil { - t.Fatal("Expected no error", err) - } - - if acct == nil { - t.Fatal("Expected account") - } - - if acct.AccountState != "active" { - t.Fatal("Expected active, got", acct.AccountState) - } - if acct.Plan != "Growth" { - t.Fatal("Expected Growth, got", acct.Plan) - } - if acct.MinutesUsed != 12549 { - t.Fatal("Expected 12549, got", acct.MinutesUsed) - } - if acct.MinutesIncluded != 25000 { - t.Fatal("Expected 25000, got", acct.MinutesIncluded) - } - if acct.BillingState != "active" { - t.Fatal("Expected active, got", acct.BillingState) - } - if acct.IntegrationMode != true { - t.Fatal("Expected true, got", acct.IntegrationMode) - } - - expectedStatus = http.StatusConflict - acct, err = zc.GetAccount() - if err == nil { - t.Fatal("Expected error") - } - - if acct != nil { - t.Fatal("Expected no account") - } - - srv.Close() - expectedStatus = http.StatusOK - returnBody = false - - acct, err = zc.GetAccount() - if err == nil { - t.Fatal("Expected error") - } - - if acct != nil { - t.Fatal("Expected no account") - } -} diff --git a/vendor/github.com/flavioribeiro/zencoder/inputs.go b/vendor/github.com/flavioribeiro/zencoder/inputs.go deleted file mode 100644 index b6e35cc0..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/inputs.go +++ /dev/null @@ -1,27 +0,0 @@ -package zencoder - -import ( - "fmt" -) - -// Get Input Details -func (z *Zencoder) GetInputDetails(id int32) (*InputMediaFile, error) { - var details InputMediaFile - - if err := z.getBody(fmt.Sprintf("inputs/%d.json", id), &details); err != nil { - return nil, err - } - - return &details, nil -} - -// Input Progress -func (z *Zencoder) GetInputProgress(id int32) (*FileProgress, error) { - var details FileProgress - - if err := z.getBody(fmt.Sprintf("inputs/%d/progress.json", id), &details); err != nil { - return nil, err - } - - return &details, nil -} diff --git a/vendor/github.com/flavioribeiro/zencoder/inputs_test.go b/vendor/github.com/flavioribeiro/zencoder/inputs_test.go deleted file mode 100644 index adb52f31..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/inputs_test.go +++ /dev/null @@ -1,243 +0,0 @@ -package zencoder - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" -) - -func TestGetInputDetails(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/inputs/123.json", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "audio_bitrate_in_kbps": 96, - "audio_codec": "aac", - "audio_sample_rate": 48000, - "channels": "2", - "duration_in_ms": 24892, - "file_size_in_bytes": 1862748, - "format": "mpeg4", - "frame_rate": 29.98, - "height": 352, - "id": 6816, - "job_id": 6816, - "privacy": false, - "state": "finished", - "total_bitrate_in_kbps": 594, - "url": "s3://example/file.mp4", - "video_bitrate_in_kbps": 498, - "video_codec": "h264", - "width": 624, - "md5_checksum": "7f106918e02a69466afa0ee014174143" -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - details, err := zc.GetInputDetails(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - if details == nil { - t.Fatal("Expected details") - } - - if details.AudioBitrateInKbps != 96 { - t.Fatal("Expected 96, got", details.AudioBitrateInKbps) - } - if details.AudioCodec != "aac" { - t.Fatal("Expected aac, got", details.AudioCodec) - } - if details.AudioSampleRate != 48000 { - t.Fatal("Expected 48000, got", details.AudioSampleRate) - } - if details.Channels != "2" { - t.Fatal("Expected 2, got", details.Channels) - } - if details.DurationInMs != 24892 { - t.Fatal("Expected 24892, got", details.DurationInMs) - } - if details.FileSizeInBytes != 1862748 { - t.Fatal("Expected 1862748, got", details.FileSizeInBytes) - } - if details.Format != "mpeg4" { - t.Fatal("Expected mpeg4, got", details.Format) - } - if details.FrameRate != 29.98 { - t.Fatal("Expected 29.98, got", details.FrameRate) - } - if details.Height != 352 { - t.Fatal("Expected 352, got", details.Height) - } - if details.Id != 6816 { - t.Fatal("Expected 6816, got", details.Id) - } - if details.JobId != 6816 { - t.Fatal("Expected 6816, got", details.JobId) - } - if details.Privacy != false { - t.Fatal("Expected false, got", details.Privacy) - } - if details.State != "finished" { - t.Fatal("Expected finished, got", details.State) - } - if details.TotalBitrateInKbps != 594 { - t.Fatal("Expected 594, got", details.TotalBitrateInKbps) - } - if details.Url != "s3://example/file.mp4" { - t.Fatal("Expected s3://example/file.mp4, got", details.Url) - } - if details.VideoBitrateInKbps != 498 { - t.Fatal("Expected 498, got", details.VideoBitrateInKbps) - } - if details.VideoCodec != "h264" { - t.Fatal("Expected h264, got", details.VideoCodec) - } - if details.Width != 624 { - t.Fatal("Expected 624, got", details.Width) - } - if details.MD5Checksum != "7f106918e02a69466afa0ee014174143" { - t.Fatal("Expected 7f106918e02a69466afa0ee014174143, got", details.MD5Checksum) - } - - expectedStatus = http.StatusInternalServerError - - details, err = zc.GetInputDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - expectedStatus = http.StatusOK - returnBody = false - - details, err = zc.GetInputDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - srv.Close() - returnBody = true - - details, err = zc.GetInputDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } -} - -func TestGetInputProgress(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/inputs/123/progress.json", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "state": "processing", - "current_event": "Downloading", - "current_event_progress": 32.34567345, - "progress": 45.2353255 -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - progress, err := zc.GetInputProgress(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - if progress == nil { - t.Fatal("Expected progress") - } - - if progress.State != "processing" { - t.Fatal("Expected processing, got", progress.State) - } - - if progress.CurrentEvent != "Downloading" { - t.Fatal("Expected Downloading, got", progress.CurrentEvent) - } - - if progress.CurrentEventProgress != 32.34567345 { - t.Fatal("Expected 32.34567345, got", progress.CurrentEventProgress) - } - - if progress.OverallProgress != 45.2353255 { - t.Fatal("Expected 45.2353255, got", progress.OverallProgress) - } - - expectedStatus = http.StatusInternalServerError - - progress, err = zc.GetInputProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no progress", progress) - } - - expectedStatus = http.StatusOK - returnBody = false - - progress, err = zc.GetInputProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no progress", progress) - } - - srv.Close() - returnBody = true - - progress, err = zc.GetInputProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no progress", progress) - } -} diff --git a/vendor/github.com/flavioribeiro/zencoder/jobs.go b/vendor/github.com/flavioribeiro/zencoder/jobs.go deleted file mode 100644 index 93a58b90..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/jobs.go +++ /dev/null @@ -1,171 +0,0 @@ -package zencoder - -import ( - "fmt" -) - -type FileProgress struct { - Id int64 `json:"id,omitempty"` - State string `json:"state,omitempty"` - CurrentEvent string `json:"current_event,omitempty"` - CurrentEventProgress float64 `json:"current_event_progress,omitempty"` - OverallProgress float64 `json:"progress,omitempty"` -} - -type JobProgress struct { - State JobState `json:"state,omitempty"` - JobProgress float64 `json:"progress,omitempty"` - InputProgress *FileProgress `json:"input,omitempty"` - OutputProgress []*FileProgress `json:"outputs,omitempty"` -} - -type JobState string - -const ( - JobStatePending = JobState("pending") - JobStateWaiting = JobState("waiting") - JobStateProcessing = JobState("processing") - JobStateAssigning = JobState("assigning") - JobStateFinished = JobState("finished") - JobStateCancelled = JobState("cancelled") - JobStateFailed = JobState("failed") -) - -// Response from CreateJob -type CreateJobResponse struct { - Id int64 `json:"id,omitempty"` - Test bool `json:"test,omitempty"` - Outputs []struct { - Id int64 `json:"id,omitempty"` - Label *string `json:"label,omitempty"` - Url string `json:"url,omitempty"` - } `json:"outputs,omitempty"` -} - -// A MediaFile -type MediaFile struct { - Id int64 `json:"id,omitempty"` - Url string `json:"url,omitempty"` - Format string `json:"format,omitempty"` - State string `json:"state,omitempty"` - Test bool `json:"test,omitempty"` - Privacy bool `json:"privacy"` - Width int32 `json:"width,omitempty"` - Height int32 `json:"height,omitempty"` - FrameRate float64 `json:"frame_rate,omitempty"` - DurationInMs int32 `json:"duration_in_ms,omitempty"` - Channels string `json:"channels,omitempty"` - AudioCodec string `json:"audio_codec,omitempty"` - AudioBitrateInKbps int32 `json:"audio_bitrate_in_kbps,omitempty"` - AudioSampleRate int32 `json:"audio_sample_rate,omitempty"` - VideoCodec string `json:"video_codec,omitempty"` - VideoBitrateInKbps int32 `json:"video_bitrate_in_kbps,omitempty"` - TotalBitrateInKbps int32 `json:"total_bitrate_in_kbps,omitempty"` - MD5Checksum string `json:"md5_checksum,omitempty"` - ErrorMessage *string `json:"error_message,omitempty"` - ErrorClass *string `json:"error_class,omitempty"` - Label *string `json:"label,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - FinishedAt string `json:"finished_at,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - FileSizeInBytes int64 `json:"file_size_bytes,omitempty"` -} - -type InputMediaFile struct { - MediaFile - FileSizeInBytes int64 `json:"file_size_in_bytes,omitempty"` - JobId int64 `json:"job_id,omitempty"` -} - -type OutputMediaFile struct { - MediaFile - FileSizeInBytes int64 `json:"file_size_in_bytes,omitempty"` - JobId int64 `json:"job_id,omitempty"` -} - -// A Thumbnail -type Thumbnail struct { - Id int64 `json:"id,omitempty"` - Url string `json:"url,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` -} - -// A Job -type Job struct { - Id int64 `json:"id,omitempty"` - PassThrough *string `json:"pass_through,omitempty"` - State string `json:"state,omitempty"` - InputMediaFile *MediaFile `json:"input_media_file,omitempty"` - Test bool `json:"test,omitempty"` - OutputMediaFiles []*MediaFile `json:"output_media_files,omitempty"` - Thumbnails []*Thumbnail `json:"thumbnails,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - FinishedAt string `json:"finished_at,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - SubmittedAt string `json:"submitted_at,omitempty"` -} - -// Job Details wrapper -type JobDetails struct { - Job *Job `json:"job,omitempty"` -} - -// Create a Job -func (z *Zencoder) CreateJob(settings *EncodingSettings) (*CreateJobResponse, error) { - var result CreateJobResponse - - if err := z.post("jobs", settings, &result); err != nil { - return nil, err - } - - return &result, nil -} - -// List Jobs -func (z *Zencoder) ListJobs() ([]*JobDetails, error) { - var result []*JobDetails - - if err := z.getBody("jobs.json", &result); err != nil { - return nil, err - } - - return result, nil -} - -// Get Job Details -func (z *Zencoder) GetJobDetails(id int64) (*JobDetails, error) { - var result JobDetails - - if err := z.getBody(fmt.Sprintf("jobs/%d.json", id), &result); err != nil { - return nil, err - } - - return &result, nil -} - -// Job Progress -func (z *Zencoder) GetJobProgress(id int64) (*JobProgress, error) { - var result JobProgress - - if err := z.getBody(fmt.Sprintf("jobs/%d/progress.json", id), &result); err != nil { - return nil, err - } - - return &result, nil -} - -// Resubmit a Job -func (z *Zencoder) ResubmitJob(id int64) error { - return z.putNoContent(fmt.Sprintf("jobs/%d/resubmit.json", id)) -} - -// Cancel a Job -func (z *Zencoder) CancelJob(id int64) error { - return z.putNoContent(fmt.Sprintf("jobs/%d/cancel.json", id)) -} - -// Finish a Live Job -func (z *Zencoder) FinishLiveJob(id int64) error { - return z.putNoContent(fmt.Sprintf("jobs/%d/finish", id)) -} diff --git a/vendor/github.com/flavioribeiro/zencoder/jobs_test.go b/vendor/github.com/flavioribeiro/zencoder/jobs_test.go deleted file mode 100644 index 7cab4280..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/jobs_test.go +++ /dev/null @@ -1,929 +0,0 @@ -package zencoder - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" -) - -func TestCreateJob(t *testing.T) { - expectedStatus := http.StatusCreated - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/jobs", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(expectedStatus) - if expectedStatus != http.StatusCreated { - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{"id": 1234,"outputs": [{"id": 4321}]}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - var settings EncodingSettings - resp, err := zc.CreateJob(&settings) - if err != nil { - t.Fatal("Expected no error", err) - } - - if resp == nil { - t.Fatal("Expected a response") - } - - if resp.Id != 1234 { - t.Fatal("Expected Id=1234", resp.Id) - } - - if len(resp.Outputs) != 1 { - t.Fatal("Expected one output", len(resp.Outputs)) - } - - if resp.Outputs[0].Id != 4321 { - t.Fatal("Expected Id=4321", resp.Outputs[0].Id) - } - - expectedStatus = http.StatusInternalServerError - resp, err = zc.CreateJob(&settings) - if err == nil { - t.Fatal("Expected error") - } - - if resp != nil { - t.Fatal("Expected no response") - } - - returnBody = false - expectedStatus = http.StatusOK - - resp, err = zc.CreateJob(&settings) - if err == nil { - t.Fatal("Expected error") - } - - if resp != nil { - t.Fatal("Expected no response") - } - - returnBody = true - srv.Close() - - resp, err = zc.CreateJob(&settings) - if err == nil { - t.Fatal("Expected error") - } - - if resp != nil { - t.Fatal("Expected no response") - } -} - -func TestListJobs(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/jobs.json", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `[{ - "job": { - "created_at": "2010-01-01T00:00:00Z", - "finished_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "submitted_at": "2010-01-01T00:00:00Z", - "pass_through": null, - "id": 1, - "input_media_file": { - "format": "mpeg4", - "created_at": "2010-01-01T00:00:00Z", - "frame_rate": 29, - "finished_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "duration_in_ms": 24883, - "audio_sample_rate": 48000, - "url": "s3://bucket/test.mp4", - "id": 1, - "error_message": null, - "error_class": null, - "audio_bitrate_in_kbps": 95, - "audio_codec": "aac", - "height": 352, - "file_size_bytes": 1862748, - "video_codec": "h264", - "test": false, - "total_bitrate_in_kbps": 593, - "channels": "2", - "width": 624, - "video_bitrate_in_kbps": 498, - "state": "finished" - }, - "test": false, - "output_media_files": [{ - "format": "mpeg4", - "created_at": "2010-01-01T00:00:00Z", - "frame_rate": 29, - "finished_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "duration_in_ms": 24883, - "audio_sample_rate": 44100, - "url": "http://s3.amazonaws.com/bucket/video.mp4", - "id": 1, - "error_message": null, - "error_class": null, - "audio_bitrate_in_kbps": 92, - "audio_codec": "aac", - "height": 352, - "file_size_bytes": 1386663, - "video_codec": "h264", - "test": false, - "total_bitrate_in_kbps": 443, - "channels": "2", - "width": 624, - "video_bitrate_in_kbps": 351, - "state": "finished", - "label": "Web" - }], - "thumbnails": [{ - "created_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "url": "http://s3.amazonaws.com/bucket/video/frame_0000.png", - "id": 1 - }], - "state": "finished" - } -}]`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - jobs, err := zc.ListJobs() - if err != nil { - t.Fatal("Expected no error", err) - } - - if jobs == nil { - t.Fatal("Expected jobs") - } - - if len(jobs) != 1 { - t.Fatal("Expected 1 job", len(jobs)) - } - - if jobs[0].Job.CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.CreatedAt) - } - if jobs[0].Job.FinishedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.FinishedAt) - } - if jobs[0].Job.UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.UpdatedAt) - } - if jobs[0].Job.SubmittedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.SubmittedAt) - } - if jobs[0].Job.PassThrough != nil { - t.Fatal("Expected nil, got", jobs[0].Job.PassThrough) - } - if jobs[0].Job.Id != 1 { - t.Fatal("Expected 1, got", jobs[0].Job.Id) - } - if jobs[0].Job.InputMediaFile.Format != "mpeg4" { - t.Fatal("Expected mpeg4, got", jobs[0].Job.InputMediaFile.Format) - } - if jobs[0].Job.InputMediaFile.CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.InputMediaFile.CreatedAt) - } - if jobs[0].Job.InputMediaFile.FrameRate != 29 { - t.Fatal("Expected 29, got", jobs[0].Job.InputMediaFile.FrameRate) - } - if jobs[0].Job.InputMediaFile.FinishedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.InputMediaFile.FinishedAt) - } - if jobs[0].Job.InputMediaFile.UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.InputMediaFile.UpdatedAt) - } - if jobs[0].Job.InputMediaFile.DurationInMs != 24883 { - t.Fatal("Expected 24883, got", jobs[0].Job.InputMediaFile.DurationInMs) - } - if jobs[0].Job.InputMediaFile.AudioSampleRate != 48000 { - t.Fatal("Expected 48000, got", jobs[0].Job.InputMediaFile.AudioSampleRate) - } - if jobs[0].Job.InputMediaFile.Url != "s3://bucket/test.mp4" { - t.Fatal("Expected s3://bucket/test.mp4, got", jobs[0].Job.InputMediaFile.Url) - } - if jobs[0].Job.InputMediaFile.Id != 1 { - t.Fatal("Expected 1, got", jobs[0].Job.InputMediaFile.Id) - } - if jobs[0].Job.InputMediaFile.ErrorMessage != nil { - t.Fatal("Expected nil, got", jobs[0].Job.InputMediaFile.ErrorMessage) - } - if jobs[0].Job.InputMediaFile.ErrorClass != nil { - t.Fatal("Expected nil, got", jobs[0].Job.InputMediaFile.ErrorClass) - } - if jobs[0].Job.InputMediaFile.AudioBitrateInKbps != 95 { - t.Fatal("Expected 95, got", jobs[0].Job.InputMediaFile.AudioBitrateInKbps) - } - if jobs[0].Job.InputMediaFile.AudioCodec != "aac" { - t.Fatal("Expected aac, got", jobs[0].Job.InputMediaFile.AudioCodec) - } - if jobs[0].Job.InputMediaFile.Height != 352 { - t.Fatal("Expected 352, got", jobs[0].Job.InputMediaFile.Height) - } - if jobs[0].Job.InputMediaFile.FileSizeInBytes != 1862748 { - t.Fatal("Expected 1862748, got", jobs[0].Job.InputMediaFile.FileSizeInBytes) - } - if jobs[0].Job.InputMediaFile.VideoCodec != "h264" { - t.Fatal("Expected h264, got", jobs[0].Job.InputMediaFile.VideoCodec) - } - if jobs[0].Job.InputMediaFile.Test != false { - t.Fatal("Expected false, got", jobs[0].Job.InputMediaFile.Test) - } - if jobs[0].Job.InputMediaFile.TotalBitrateInKbps != 593 { - t.Fatal("Expected 593, got", jobs[0].Job.InputMediaFile.TotalBitrateInKbps) - } - if jobs[0].Job.InputMediaFile.Channels != "2" { - t.Fatal("Expected 2, got", jobs[0].Job.InputMediaFile.Channels) - } - if jobs[0].Job.InputMediaFile.Width != 624 { - t.Fatal("Expected 624, got", jobs[0].Job.InputMediaFile.Width) - } - if jobs[0].Job.InputMediaFile.VideoBitrateInKbps != 498 { - t.Fatal("Expected 498, got", jobs[0].Job.InputMediaFile.VideoBitrateInKbps) - } - if jobs[0].Job.InputMediaFile.State != "finished" { - t.Fatal("Expected finished, got", jobs[0].Job.InputMediaFile.State) - } - if jobs[0].Job.Test != false { - t.Fatal("Expected false, got", jobs[0].Job.Test) - } - if len(jobs[0].Job.OutputMediaFiles) != 1 { - t.Fatal("Expected 1 outputs, got", len(jobs[0].Job.OutputMediaFiles)) - } - if jobs[0].Job.OutputMediaFiles[0].Format != "mpeg4" { - t.Fatal("Expected mpeg4, got", jobs[0].Job.OutputMediaFiles[0].Format) - } - if jobs[0].Job.OutputMediaFiles[0].CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.OutputMediaFiles[0].CreatedAt) - } - if jobs[0].Job.OutputMediaFiles[0].FrameRate != 29 { - t.Fatal("Expected 29, got", jobs[0].Job.OutputMediaFiles[0].FrameRate) - } - if jobs[0].Job.OutputMediaFiles[0].FinishedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.OutputMediaFiles[0].FinishedAt) - } - if jobs[0].Job.OutputMediaFiles[0].UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.OutputMediaFiles[0].UpdatedAt) - } - if jobs[0].Job.OutputMediaFiles[0].DurationInMs != 24883 { - t.Fatal("Expected 24883, got", jobs[0].Job.OutputMediaFiles[0].DurationInMs) - } - if jobs[0].Job.OutputMediaFiles[0].AudioSampleRate != 44100 { - t.Fatal("Expected 44100, got", jobs[0].Job.OutputMediaFiles[0].AudioSampleRate) - } - if jobs[0].Job.OutputMediaFiles[0].Url != "http://s3.amazonaws.com/bucket/video.mp4" { - t.Fatal("Expected http://s3.amazonaws.com/bucket/video.mp4, got", jobs[0].Job.OutputMediaFiles[0].Url) - } - if jobs[0].Job.OutputMediaFiles[0].Id != 1 { - t.Fatal("Expected 1, got", jobs[0].Job.OutputMediaFiles[0].Id) - } - if jobs[0].Job.OutputMediaFiles[0].ErrorMessage != nil { - t.Fatal("Expected nil, got", jobs[0].Job.OutputMediaFiles[0].ErrorMessage) - } - if jobs[0].Job.OutputMediaFiles[0].ErrorClass != nil { - t.Fatal("Expected nil, got", jobs[0].Job.OutputMediaFiles[0].ErrorClass) - } - if jobs[0].Job.OutputMediaFiles[0].AudioBitrateInKbps != 92 { - t.Fatal("Expected 92, got", jobs[0].Job.OutputMediaFiles[0].AudioBitrateInKbps) - } - if jobs[0].Job.OutputMediaFiles[0].AudioCodec != "aac" { - t.Fatal("Expected aac, got", jobs[0].Job.OutputMediaFiles[0].AudioCodec) - } - if jobs[0].Job.OutputMediaFiles[0].Height != 352 { - t.Fatal("Expected 352, got", jobs[0].Job.OutputMediaFiles[0].Height) - } - if jobs[0].Job.OutputMediaFiles[0].FileSizeInBytes != 1386663 { - t.Fatal("Expected 1386663, got", jobs[0].Job.OutputMediaFiles[0].FileSizeInBytes) - } - if jobs[0].Job.OutputMediaFiles[0].VideoCodec != "h264" { - t.Fatal("Expected h264, got", jobs[0].Job.OutputMediaFiles[0].VideoCodec) - } - if jobs[0].Job.OutputMediaFiles[0].Test != false { - t.Fatal("Expected false, got", jobs[0].Job.OutputMediaFiles[0].Test) - } - if jobs[0].Job.OutputMediaFiles[0].TotalBitrateInKbps != 443 { - t.Fatal("Expected 443, got", jobs[0].Job.OutputMediaFiles[0].TotalBitrateInKbps) - } - if jobs[0].Job.OutputMediaFiles[0].Channels != "2" { - t.Fatal("Expected 2, got", jobs[0].Job.OutputMediaFiles[0].Channels) - } - if jobs[0].Job.OutputMediaFiles[0].Width != 624 { - t.Fatal("Expected 624, got", jobs[0].Job.OutputMediaFiles[0].Width) - } - if jobs[0].Job.OutputMediaFiles[0].VideoBitrateInKbps != 351 { - t.Fatal("Expected 351, got", jobs[0].Job.OutputMediaFiles[0].VideoBitrateInKbps) - } - if jobs[0].Job.OutputMediaFiles[0].State != "finished" { - t.Fatal("Expected finished, got", jobs[0].Job.OutputMediaFiles[0].State) - } - if jobs[0].Job.OutputMediaFiles[0].Label == nil || *jobs[0].Job.OutputMediaFiles[0].Label != "Web" { - t.Fatal("Expected Web, got", jobs[0].Job.OutputMediaFiles[0].Label) - } - if len(jobs[0].Job.Thumbnails) != 1 { - t.Fatal("Expected 1 thumbnail, got", len(jobs[0].Job.Thumbnails)) - } - if jobs[0].Job.Thumbnails[0].CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.Thumbnails[0].CreatedAt) - } - if jobs[0].Job.Thumbnails[0].UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", jobs[0].Job.Thumbnails[0].UpdatedAt) - } - if jobs[0].Job.Thumbnails[0].Url != "http://s3.amazonaws.com/bucket/video/frame_0000.png" { - t.Fatal("Expected http://s3.amazonaws.com/bucket/video/frame_0000.png, got", jobs[0].Job.Thumbnails[0].Url) - } - if jobs[0].Job.Thumbnails[0].Id != 1 { - t.Fatal("Expected 1, got", jobs[0].Job.Thumbnails[0].Id) - } - if jobs[0].Job.State != "finished" { - t.Fatal("Expected finished, got", jobs[0].Job.State) - } - - expectedStatus = http.StatusInternalServerError - jobs, err = zc.ListJobs() - if err == nil { - t.Fatal("Expected error") - } - - if jobs != nil { - t.Fatal("Expected no response") - } - - expectedStatus = http.StatusOK - returnBody = false - jobs, err = zc.ListJobs() - if err == nil { - t.Fatal("Expected error") - } - - if jobs != nil { - t.Fatal("Expected no response") - } - - srv.Close() - returnBody = true - jobs, err = zc.ListJobs() - if err == nil { - t.Fatal("Expected error") - } - - if jobs != nil { - t.Fatal("Expected no response") - } -} - -func TestGetJobDetails(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/jobs/123.json", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "job": { - "created_at": "2010-01-01T00:00:00Z", - "finished_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "submitted_at": "2010-01-01T00:00:00Z", - "pass_through": null, - "id": 1, - "input_media_file": { - "format": "mpeg4", - "created_at": "2010-01-01T00:00:00Z", - "frame_rate": 29, - "finished_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "duration_in_ms": 24883, - "audio_sample_rate": 48000, - "url": "s3://bucket/test.mp4", - "id": 1, - "error_message": null, - "error_class": null, - "audio_bitrate_in_kbps": 95, - "audio_codec": "aac", - "height": 352, - "file_size_bytes": 1862748, - "video_codec": "h264", - "test": false, - "total_bitrate_in_kbps": 593, - "channels": "2", - "width": 624, - "video_bitrate_in_kbps": 498, - "state": "finished", - "md5_checksum":"7f106918e02a69466afa0ee014174143" - }, - "test": false, - "output_media_files": [{ - "format": "mpeg4", - "created_at": "2010-01-01T00:00:00Z", - "frame_rate": 29, - "finished_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "duration_in_ms": 24883, - "audio_sample_rate": 44100, - "url": "http://s3.amazonaws.com/bucket/video.mp4", - "id": 1, - "error_message": null, - "error_class": null, - "audio_bitrate_in_kbps": 92, - "audio_codec": "aac", - "height": 352, - "file_size_bytes": 1386663, - "video_codec": "h264", - "test": false, - "total_bitrate_in_kbps": 443, - "channels": "2", - "width": 624, - "video_bitrate_in_kbps": 351, - "state": "finished", - "label": "Web", - "md5_checksum":"7f106918e02a69466afa0ee014172496" - }], - "thumbnails": [{ - "created_at": "2010-01-01T00:00:00Z", - "updated_at": "2010-01-01T00:00:00Z", - "url": "http://s3.amazonaws.com/bucket/video/frame_0000.png", - "id": 1 - }], - "state": "finished" - } -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - details, err := zc.GetJobDetails(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - if details == nil { - t.Fatal("Expected details") - } - - if details.Job.CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.CreatedAt) - } - if details.Job.FinishedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.FinishedAt) - } - if details.Job.UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.UpdatedAt) - } - if details.Job.SubmittedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.SubmittedAt) - } - if details.Job.PassThrough != nil { - t.Fatal("Expected nil, got", details.Job.PassThrough) - } - if details.Job.Id != 1 { - t.Fatal("Expected 1, got", details.Job.Id) - } - if details.Job.Test != false { - t.Fatal("Expected false, got", details.Job.Test) - } - if details.Job.State != "finished" { - t.Fatal("Expected finished, got", details.Job.State) - } - - if details.Job.InputMediaFile.Format != "mpeg4" { - t.Fatal("Expected mpeg4, got", details.Job.InputMediaFile.Format) - } - if details.Job.InputMediaFile.CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.InputMediaFile.CreatedAt) - } - if details.Job.InputMediaFile.FrameRate != 29 { - t.Fatal("Expected 29, got", details.Job.InputMediaFile.FrameRate) - } - if details.Job.InputMediaFile.FinishedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.InputMediaFile.FinishedAt) - } - if details.Job.InputMediaFile.UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.InputMediaFile.UpdatedAt) - } - if details.Job.InputMediaFile.DurationInMs != 24883 { - t.Fatal("Expected 24883, got", details.Job.InputMediaFile.DurationInMs) - } - if details.Job.InputMediaFile.AudioSampleRate != 48000 { - t.Fatal("Expected 48000, got", details.Job.InputMediaFile.AudioSampleRate) - } - if details.Job.InputMediaFile.Url != "s3://bucket/test.mp4" { - t.Fatal("Expected s3://bucket/test.mp4, got", details.Job.InputMediaFile.Url) - } - if details.Job.InputMediaFile.Id != 1 { - t.Fatal("Expected 1, got", details.Job.InputMediaFile.Id) - } - if details.Job.InputMediaFile.ErrorMessage != nil { - t.Fatal("Expected nil, got", details.Job.InputMediaFile.ErrorMessage) - } - if details.Job.InputMediaFile.ErrorClass != nil { - t.Fatal("Expected nil, got", details.Job.InputMediaFile.ErrorClass) - } - if details.Job.InputMediaFile.AudioBitrateInKbps != 95 { - t.Fatal("Expected 95, got", details.Job.InputMediaFile.AudioBitrateInKbps) - } - if details.Job.InputMediaFile.AudioCodec != "aac" { - t.Fatal("Expected aac, got", details.Job.InputMediaFile.AudioCodec) - } - if details.Job.InputMediaFile.Height != 352 { - t.Fatal("Expected 352, got", details.Job.InputMediaFile.Height) - } - if details.Job.InputMediaFile.FileSizeInBytes != 1862748 { - t.Fatal("Expected 1862748, got", details.Job.InputMediaFile.FileSizeInBytes) - } - if details.Job.InputMediaFile.VideoCodec != "h264" { - t.Fatal("Expected h264, got", details.Job.InputMediaFile.VideoCodec) - } - if details.Job.InputMediaFile.Test != false { - t.Fatal("Expected false, got", details.Job.InputMediaFile.Test) - } - if details.Job.InputMediaFile.TotalBitrateInKbps != 593 { - t.Fatal("Expected 593, got", details.Job.InputMediaFile.TotalBitrateInKbps) - } - if details.Job.InputMediaFile.Channels != "2" { - t.Fatal("Expected 2, got", details.Job.InputMediaFile.Channels) - } - if details.Job.InputMediaFile.Width != 624 { - t.Fatal("Expected 624, got", details.Job.InputMediaFile.Width) - } - if details.Job.InputMediaFile.VideoBitrateInKbps != 498 { - t.Fatal("Expected 498, got", details.Job.InputMediaFile.VideoBitrateInKbps) - } - if details.Job.InputMediaFile.State != "finished" { - t.Fatal("Expected finished, got", details.Job.InputMediaFile.State) - } - if details.Job.InputMediaFile.MD5Checksum != "7f106918e02a69466afa0ee014174143" { - t.Fatal("Expected 7f106918e02a69466afa0ee014174143, got", details.Job.InputMediaFile.MD5Checksum) - } - - if details.Job.OutputMediaFiles[0].Format != "mpeg4" { - t.Fatal("Expected mpeg4, got", details.Job.OutputMediaFiles[0].Format) - } - if details.Job.OutputMediaFiles[0].CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.OutputMediaFiles[0].CreatedAt) - } - if details.Job.OutputMediaFiles[0].FrameRate != 29 { - t.Fatal("Expected 29, got", details.Job.OutputMediaFiles[0].FrameRate) - } - if details.Job.OutputMediaFiles[0].FinishedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.OutputMediaFiles[0].FinishedAt) - } - if details.Job.OutputMediaFiles[0].UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.OutputMediaFiles[0].UpdatedAt) - } - if details.Job.OutputMediaFiles[0].DurationInMs != 24883 { - t.Fatal("Expected 24883, got", details.Job.OutputMediaFiles[0].DurationInMs) - } - if details.Job.OutputMediaFiles[0].AudioSampleRate != 44100 { - t.Fatal("Expected 44100, got", details.Job.OutputMediaFiles[0].AudioSampleRate) - } - if details.Job.OutputMediaFiles[0].Url != "http://s3.amazonaws.com/bucket/video.mp4" { - t.Fatal("Expected http://s3.amazonaws.com/bucket/video.mp4, got", details.Job.OutputMediaFiles[0].Url) - } - if details.Job.OutputMediaFiles[0].Id != 1 { - t.Fatal("Expected 1, got", details.Job.OutputMediaFiles[0].Id) - } - if details.Job.OutputMediaFiles[0].ErrorMessage != nil { - t.Fatal("Expected nil, got", details.Job.OutputMediaFiles[0].ErrorMessage) - } - if details.Job.OutputMediaFiles[0].ErrorClass != nil { - t.Fatal("Expected nil, got", details.Job.OutputMediaFiles[0].ErrorClass) - } - if details.Job.OutputMediaFiles[0].AudioBitrateInKbps != 92 { - t.Fatal("Expected 92, got", details.Job.OutputMediaFiles[0].AudioBitrateInKbps) - } - if details.Job.OutputMediaFiles[0].AudioCodec != "aac" { - t.Fatal("Expected aac, got", details.Job.OutputMediaFiles[0].AudioCodec) - } - if details.Job.OutputMediaFiles[0].Height != 352 { - t.Fatal("Expected 352, got", details.Job.OutputMediaFiles[0].Height) - } - if details.Job.OutputMediaFiles[0].FileSizeInBytes != 1386663 { - t.Fatal("Expected 1386663, got", details.Job.OutputMediaFiles[0].FileSizeInBytes) - } - if details.Job.OutputMediaFiles[0].VideoCodec != "h264" { - t.Fatal("Expected h264, got", details.Job.OutputMediaFiles[0].VideoCodec) - } - if details.Job.OutputMediaFiles[0].Test != false { - t.Fatal("Expected false, got", details.Job.OutputMediaFiles[0].Test) - } - if details.Job.OutputMediaFiles[0].TotalBitrateInKbps != 443 { - t.Fatal("Expected 443, got", details.Job.OutputMediaFiles[0].TotalBitrateInKbps) - } - if details.Job.OutputMediaFiles[0].Channels != "2" { - t.Fatal("Expected 2, got", details.Job.OutputMediaFiles[0].Channels) - } - if details.Job.OutputMediaFiles[0].Width != 624 { - t.Fatal("Expected 624, got", details.Job.OutputMediaFiles[0].Width) - } - if details.Job.OutputMediaFiles[0].VideoBitrateInKbps != 351 { - t.Fatal("Expected 351, got", details.Job.OutputMediaFiles[0].VideoBitrateInKbps) - } - if details.Job.OutputMediaFiles[0].State != "finished" { - t.Fatal("Expected finished, got", details.Job.OutputMediaFiles[0].State) - } - if details.Job.OutputMediaFiles[0].Label == nil || *details.Job.OutputMediaFiles[0].Label != "Web" { - t.Fatal("Expected Web, got", details.Job.OutputMediaFiles[0].Label) - } - if details.Job.OutputMediaFiles[0].MD5Checksum != "7f106918e02a69466afa0ee014172496" { - t.Fatal("Expected 7f106918e02a69466afa0ee014172496, got", details.Job.OutputMediaFiles[0].MD5Checksum) - } - if details.Job.Thumbnails[0].CreatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.Thumbnails[0].CreatedAt) - } - if details.Job.Thumbnails[0].UpdatedAt != "2010-01-01T00:00:00Z" { - t.Fatal("Expected 2010-01-01T00:00:00Z, got", details.Job.Thumbnails[0].UpdatedAt) - } - if details.Job.Thumbnails[0].Url != "http://s3.amazonaws.com/bucket/video/frame_0000.png" { - t.Fatal("Expected http://s3.amazonaws.com/bucket/video/frame_0000.png, got", details.Job.Thumbnails[0].Url) - } - if details.Job.Thumbnails[0].Id != 1 { - t.Fatal("Expected 1, got", details.Job.Thumbnails[0].Id) - } - - expectedStatus = http.StatusNotFound - details, err = zc.GetJobDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no response") - } - - expectedStatus = http.StatusOK - returnBody = false - details, err = zc.GetJobDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no response") - } - - returnBody = false - srv.Close() - details, err = zc.GetJobDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no response") - } -} - -func TestGetJobProgress(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/jobs/123/progress.json", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "state": "processing", - "progress": 32.34567345, - "input": { - "id": 1234, - "state": "finished" - }, - "outputs": [ - { - "id": 4567, - "state": "processing", - "current_event": "Transcoding", - "current_event_progress": 25.0323, - "progress": 35.23532 - }, - { - "id": 4568, - "state": "processing", - "current_event": "Uploading", - "current_event_progress": 82.32, - "progress": 95.3223 - } - ] -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - progress, err := zc.GetJobProgress(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - if progress == nil { - t.Fatal("Expected response") - } - - if progress.State != "processing" { - t.Fatal("Expected processing, got", progress.State) - } - if progress.JobProgress != 32.34567345 { - t.Fatal("Expected 32.34567345, got", progress.JobProgress) - } - if progress.InputProgress.Id != 1234 { - t.Fatal("Expected 1234, got", progress.InputProgress.Id) - } - if progress.InputProgress.State != "finished" { - t.Fatal("Expected finished, got", progress.InputProgress.State) - } - - if len(progress.OutputProgress) != 2 { - t.Fatal("Expected 2 outputs, got", len(progress.OutputProgress)) - } - - if progress.OutputProgress[0].Id != 4567 { - t.Fatal("Expected 4567, got", progress.OutputProgress[0].Id) - } - if progress.OutputProgress[0].State != "processing" { - t.Fatal("Expected processing, got", progress.OutputProgress[0].State) - } - if progress.OutputProgress[0].CurrentEvent != "Transcoding" { - t.Fatal("Expected Transcoding, got", progress.OutputProgress[0].CurrentEvent) - } - if progress.OutputProgress[0].CurrentEventProgress != 25.0323 { - t.Fatal("Expected 25.0323, got", progress.OutputProgress[0].CurrentEventProgress) - } - if progress.OutputProgress[0].OverallProgress != 35.23532 { - t.Fatal("Expected 35.23532, got", progress.OutputProgress[0].OverallProgress) - } - - expectedStatus = http.StatusNotFound - progress, err = zc.GetJobProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no response", progress) - } - - expectedStatus = http.StatusOK - returnBody = false - progress, err = zc.GetJobProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no response", progress) - } - - returnBody = true - srv.Close() - progress, err = zc.GetJobProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no response", progress) - } -} - -func TestResubmitJob(t *testing.T) { - expectedStatus := http.StatusNoContent - - mux := http.NewServeMux() - mux.HandleFunc("/jobs/123/resubmit.json", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(expectedStatus) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - err := zc.ResubmitJob(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - expectedStatus = http.StatusConflict - - err = zc.ResubmitJob(123) - if err == nil { - t.Fatal("Expected error") - } - - expectedStatus = http.StatusOK - srv.Close() - - err = zc.ResubmitJob(123) - if err == nil { - t.Fatal("Expected error") - } -} - -func TestCancelJob(t *testing.T) { - expectedStatus := http.StatusNoContent - - mux := http.NewServeMux() - mux.HandleFunc("/jobs/123/cancel.json", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(expectedStatus) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - err := zc.CancelJob(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - expectedStatus = http.StatusConflict - - err = zc.CancelJob(123) - if err == nil { - t.Fatal("Expected error") - } - - expectedStatus = http.StatusOK - srv.Close() - - err = zc.CancelJob(123) - if err == nil { - t.Fatal("Expected error") - } -} - -func TestFinishLiveJob(t *testing.T) { - expectedStatus := http.StatusNoContent - - mux := http.NewServeMux() - mux.HandleFunc("/jobs/123/finish", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(expectedStatus) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - err := zc.FinishLiveJob(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - expectedStatus = http.StatusConflict - - err = zc.FinishLiveJob(123) - if err == nil { - t.Fatal("Expected error") - } -} diff --git a/vendor/github.com/flavioribeiro/zencoder/outputs.go b/vendor/github.com/flavioribeiro/zencoder/outputs.go deleted file mode 100644 index 8ccc9bc8..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/outputs.go +++ /dev/null @@ -1,27 +0,0 @@ -package zencoder - -import ( - "fmt" -) - -// Get Output Details -func (z *Zencoder) GetOutputDetails(id int64) (*OutputMediaFile, error) { - var details OutputMediaFile - - if err := z.getBody(fmt.Sprintf("outputs/%d.json", id), &details); err != nil { - return nil, err - } - - return &details, nil -} - -// Output Progress -func (z *Zencoder) GetOutputProgress(id int64) (*FileProgress, error) { - var details FileProgress - - if err := z.getBody(fmt.Sprintf("outputs/%d/progress.json", id), &details); err != nil { - return nil, err - } - - return &details, nil -} diff --git a/vendor/github.com/flavioribeiro/zencoder/outputs_test.go b/vendor/github.com/flavioribeiro/zencoder/outputs_test.go deleted file mode 100644 index 6879774e..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/outputs_test.go +++ /dev/null @@ -1,239 +0,0 @@ -package zencoder - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" -) - -func TestGetOutputDetails(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/outputs/123.json", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "audio_bitrate_in_kbps": 74, - "audio_codec": "aac", - "audio_sample_rate": 48000, - "channels": "2", - "duration_in_ms": 24892, - "file_size_in_bytes": 1215110, - "format": "mpeg4", - "frame_rate": 29.97, - "height": 352, - "id": 13339, - "label": null, - "state": "finished", - "total_bitrate_in_kbps": 387, - "url": "https://example.com/file.mp4", - "video_bitrate_in_kbps": 313, - "video_codec": "h264", - "width": 624, - "md5_checksum": "7f106918e02a69466afa0ee014174143" -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - details, err := zc.GetOutputDetails(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - if details == nil { - t.Fatal("Expected details") - } - - if details.AudioBitrateInKbps != 74 { - t.Fatal("Expected 74, got", details.AudioBitrateInKbps) - } - if details.AudioCodec != "aac" { - t.Fatal("Expected aac, got", details.AudioCodec) - } - if details.AudioSampleRate != 48000 { - t.Fatal("Expected 48000, got", details.AudioSampleRate) - } - if details.Channels != "2" { - t.Fatal("Expected 2, got", details.Channels) - } - if details.DurationInMs != 24892 { - t.Fatal("Expected 24892, got", details.DurationInMs) - } - if details.FileSizeInBytes != 1215110 { - t.Fatal("Expected 1215110, got", details.FileSizeInBytes) - } - if details.Format != "mpeg4" { - t.Fatal("Expected mpeg4, got", details.Format) - } - if details.FrameRate != 29.97 { - t.Fatal("Expected 29.97, got", details.FrameRate) - } - if details.Height != 352 { - t.Fatal("Expected 352, got", details.Height) - } - if details.Id != 13339 { - t.Fatal("Expected 13339, got", details.Id) - } - if details.Label != nil { - t.Fatal("Expected nil, got", details.Label) - } - if details.State != "finished" { - t.Fatal("Expected finished, got", details.State) - } - if details.TotalBitrateInKbps != 387 { - t.Fatal("Expected 387, got", details.TotalBitrateInKbps) - } - if details.Url != "https://example.com/file.mp4" { - t.Fatal("Expected https://example.com/file.mp4, got", details.Url) - } - if details.VideoBitrateInKbps != 313 { - t.Fatal("Expected 313, got", details.VideoBitrateInKbps) - } - if details.VideoCodec != "h264" { - t.Fatal("Expected h264, got", details.VideoCodec) - } - if details.Width != 624 { - t.Fatal("Expected 624, got", details.Width) - } - if details.MD5Checksum != "7f106918e02a69466afa0ee014174143" { - t.Fatal("Expected 7f106918e02a69466afa0ee014174143, got", details.MD5Checksum) - } - - expectedStatus = http.StatusInternalServerError - - details, err = zc.GetOutputDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - expectedStatus = http.StatusOK - returnBody = false - - details, err = zc.GetOutputDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - srv.Close() - returnBody = true - - details, err = zc.GetOutputDetails(123) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } -} - -func TestGetOutputProgress(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/outputs/123/progress.json", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "state": "processing", - "current_event": "Transcoding", - "current_event_progress": 45.32525, - "progress": 32.34567345 -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - progress, err := zc.GetOutputProgress(123) - if err != nil { - t.Fatal("Expected no error", err) - } - - if progress == nil { - t.Fatal("Expected progress") - } - - if progress.State != "processing" { - t.Fatal("Expected processing, got", progress.State) - } - - if progress.CurrentEvent != "Transcoding" { - t.Fatal("Expected Transcoding, got", progress.CurrentEvent) - } - - if progress.CurrentEventProgress != 45.32525 { - t.Fatal("Expected 45.32525, got", progress.CurrentEventProgress) - } - - if progress.OverallProgress != 32.34567345 { - t.Fatal("Expected 32.34567345, got", progress.OverallProgress) - } - - expectedStatus = http.StatusInternalServerError - - progress, err = zc.GetOutputProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no progress", progress) - } - - expectedStatus = http.StatusOK - returnBody = false - - progress, err = zc.GetOutputProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no progress", progress) - } - - srv.Close() - returnBody = true - - progress, err = zc.GetOutputProgress(123) - if err == nil { - t.Fatal("Expected error") - } - - if progress != nil { - t.Fatal("Expected no progress", progress) - } -} diff --git a/vendor/github.com/flavioribeiro/zencoder/reports.go b/vendor/github.com/flavioribeiro/zencoder/reports.go deleted file mode 100644 index 4b5b28af..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/reports.go +++ /dev/null @@ -1,155 +0,0 @@ -package zencoder - -import ( - "net/url" - "time" -) - -type ReportSettings struct { - From *time.Time //: Start date in the format YYYY-MM-DD (default: 30 days ago). - To *time.Time //: End date in the format YYYY-MM-DD (default: yesterday). - Grouping *string //: Minute usage for only one report grouping (default: none). -} - -type VodTotalStatistics struct { - EncodedMinutes int32 `json:"encoded_minutes,omitempty"` - BillableMinutes int32 `json:"billable_minutes,omitempty"` -} - -type VodStatistic struct { - Grouping string `json:"grouping,omitempty"` - CollectedOn string `json:"collected_on,omitempty"` - EncodedMinutes int32 `json:"encoded_minutes,omitempty"` - BillableMinutes int32 `json:"billable_minutes,omitempty"` -} - -type VodUsage struct { - Total *VodTotalStatistics `json:"total,omitempty"` - Statistics []*VodStatistic `json:"statistics,omitempty"` -} - -type LiveTotalStatistics struct { - StreamHours int32 `json:"stream_hours,omitempty"` - BillableStreamHours int32 `json:"billable_stream_hours,omitempty"` - EncodedHours int32 `json:"encoded_hours,omitempty"` - BillableEncodedHours int32 `json:"billable_encoded_hours,omitempty"` - TotalHours int32 `json:"total_hours,omitempty"` - TotalBillableHours int32 `json:"total_billable_hours,omitempty"` -} - -type LiveStatistic struct { - Grouping string `json:"grouping,omitempty"` - CollectedOn string `json:"collected_on,omitempty"` - StreamHours int32 `json:"stream_hours,omitempty"` - BillableStreamHours int32 `json:"billable_stream_hours,omitempty"` - EncodedHours int32 `json:"encoded_hours,omitempty"` - BillableEncodedHours int32 `json:"billable_encoded_hours,omitempty"` - TotalHours int32 `json:"total_hours,omitempty"` - TotalBillableHours int32 `json:"total_billable_hours,omitempty"` -} - -type LiveUsage struct { - Total *LiveTotalStatistics `json:"total,omitempty"` - Statistics []*LiveStatistic `json:"statistics,omitempty"` -} - -type CombinedUsage struct { - Total struct { - Live LiveTotalStatistics `json:"live,omitempty"` - Vod VodTotalStatistics `json:"vod,omitempty"` - } `json:"total,omitempty"` - Statistics struct { - Live []*LiveStatistic `json:"live,omitempty"` - Vod []*VodStatistic `json:"vod,omitempty"` - } `json:"statistics,omitempty"` -} - -func Report() *ReportSettings { - return &ReportSettings{} -} - -func ReportFrom(from time.Time) *ReportSettings { - return &ReportSettings{ - From: &from, - } -} - -func ReportTo(to time.Time) *ReportSettings { - return &ReportSettings{ - To: &to, - } -} - -func ReportGrouping(grouping string) *ReportSettings { - return &ReportSettings{ - Grouping: &grouping, - } -} - -func (s *ReportSettings) ReportFrom(from time.Time) *ReportSettings { - s.From = &from - return s -} - -func (s *ReportSettings) ReportTo(to time.Time) *ReportSettings { - s.To = &to - return s -} - -func (s *ReportSettings) ReportGrouping(grouping string) *ReportSettings { - s.Grouping = &grouping - return s -} - -func GetReportQuery(path string, settings *ReportSettings) string { - if settings != nil { - query := make(url.Values) - if settings.From != nil { - query.Set("from", settings.From.Format("2006-01-02")) - } - if settings.To != nil { - query.Set("to", settings.To.Format("2006-01-02")) - } - if settings.Grouping != nil { - query.Set("grouping", *settings.Grouping) - } - - if len(query) > 0 { - return path + "?" + query.Encode() - } - } - - return path -} - -// Get VOD Usage -func (z *Zencoder) GetVodUsage(settings *ReportSettings) (*VodUsage, error) { - var details VodUsage - - if err := z.getBody(GetReportQuery("reports/vod", settings), &details); err != nil { - return nil, err - } - - return &details, nil -} - -// Get Live Usage -func (z *Zencoder) GetLiveUsage(settings *ReportSettings) (*LiveUsage, error) { - var details LiveUsage - - if err := z.getBody(GetReportQuery("reports/live", settings), &details); err != nil { - return nil, err - } - - return &details, nil -} - -func (z *Zencoder) GetUsage(settings *ReportSettings) (*CombinedUsage, error) { - var details CombinedUsage - - if err := z.getBody(GetReportQuery("reports/all", settings), &details); err != nil { - return nil, err - } - - return &details, nil -} diff --git a/vendor/github.com/flavioribeiro/zencoder/reports_test.go b/vendor/github.com/flavioribeiro/zencoder/reports_test.go deleted file mode 100644 index d87c22a5..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/reports_test.go +++ /dev/null @@ -1,546 +0,0 @@ -package zencoder - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" - "time" -) - -func TestGetReportQuery(t *testing.T) { - resp := GetReportQuery("/path", nil) - if resp != "/path" { - t.Fatal("Expected /path, got", resp) - } - - var settings *ReportSettings - resp = GetReportQuery("/path", settings) - if resp != "/path" { - t.Fatal("Expected /path, got", resp) - } - - now := time.Date(2013, time.November, 22, 0, 0, 0, 0, time.UTC) - - settings = Report() - - settings = settings.ReportFrom(now) - resp = GetReportQuery("/path", settings) - if resp != "/path?from=2013-11-22" { - t.Fatal("Expected /path?from=2013-11-22, got", resp) - } - - settings = settings.ReportTo(now) - resp = GetReportQuery("/path", settings) - if resp != "/path?from=2013-11-22&to=2013-11-22" { - t.Fatal("Expected /path?from=2013-11-22&to=2013-11-22, got", resp) - } - - settings.From = nil - resp = GetReportQuery("/path", settings) - if resp != "/path?to=2013-11-22" { - t.Fatal("Expected /path?to=2013-11-22, got", resp) - } - - settings = settings.ReportGrouping("group by") - resp = GetReportQuery("/path", settings) - if resp != "/path?grouping=group+by&to=2013-11-22" { - t.Fatal("Expected /path?grouping=group+by&to=2013-11-22, got", resp) - } - - settings.To = nil - resp = GetReportQuery("/path", settings) - if resp != "/path?grouping=group+by" { - t.Fatal("Expected /path?grouping=group+by, got", resp) - } -} - -func TestGetReportFrom(t *testing.T) { - now := time.Date(2013, time.November, 22, 0, 0, 0, 0, time.UTC) - settings := ReportFrom(now) - if settings.From == nil || *settings.From != now { - t.Fatal("Expected now", settings.From) - } - if settings.To != nil { - t.Fatal("Expected nil", settings.To) - } - if settings.Grouping != nil { - t.Fatal("Expected nil", settings.Grouping) - } -} - -func TestGetReportTo(t *testing.T) { - now := time.Date(2013, time.November, 22, 0, 0, 0, 0, time.UTC) - settings := ReportTo(now) - if settings.From != nil { - t.Fatal("Expected nil", settings.From) - } - if settings.To == nil || *settings.To != now { - t.Fatal("Expected now", settings.To) - } - if settings.Grouping != nil { - t.Fatal("Expected nil", settings.Grouping) - } -} - -func TestGetReportGrouping(t *testing.T) { - settings := ReportGrouping("group by") - if settings.From != nil { - t.Fatal("Expected nil", settings.From) - } - if settings.To != nil { - t.Fatal("Expected nil", settings.To) - } - if settings.Grouping == nil || *settings.Grouping != "group by" { - t.Fatal("Expected group by", settings.Grouping) - } -} - -func TestGetVodUsage(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/reports/vod", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "total": { - "encoded_minutes": 6, - "billable_minutes": 8 - }, - "statistics": [ - { - "grouping": "zencoder", - "collected_on": "2011-08-10", - "encoded_minutes": 4, - "billable_minutes": 5 - }, { - "grouping": null, - "collected_on": "2011-08-10", - "encoded_minutes": 2, - "billable_minutes": 3 - } - ] -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - details, err := zc.GetVodUsage(nil) - if err != nil { - t.Fatal("Expected no error", err) - } - - if details == nil { - t.Fatal("Expected details") - } - - if details.Total.EncodedMinutes != 6 { - t.Fatal("Expected 6, got", details.Total.EncodedMinutes) - } - - if details.Total.BillableMinutes != 8 { - t.Fatal("Expected 8, got", details.Total.BillableMinutes) - } - - if len(details.Statistics) != 2 { - t.Fatal("Expected 2 statistics, got", len(details.Statistics)) - } - - if details.Statistics[0].Grouping != "zencoder" { - t.Fatal("Expected zencoder, got", details.Statistics[0].Grouping) - } - - if details.Statistics[0].CollectedOn != "2011-08-10" { - t.Fatal("Expected 2011-08-10, got", details.Statistics[0].CollectedOn) - } - - if details.Statistics[0].EncodedMinutes != 4 { - t.Fatal("Expected 4, got", details.Statistics[0].EncodedMinutes) - } - - if details.Statistics[0].BillableMinutes != 5 { - t.Fatal("Expected 5, got", details.Statistics[0].BillableMinutes) - } - - expectedStatus = http.StatusInternalServerError - - details, err = zc.GetVodUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - expectedStatus = http.StatusOK - returnBody = false - - details, err = zc.GetVodUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - srv.Close() - returnBody = false - - details, err = zc.GetVodUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } -} - -func TestGetLiveUsage(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/reports/live", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "total": { - "stream_hours": 5, - "billable_stream_hours": 6, - "encoded_hours": 5, - "billable_encoded_hours": 6, - "total_hours": 10, - "total_billable_hours": 12 - }, - "statistics": [ - { - "grouping": "zencoder", - "collected_on": "2011-08-10", - "stream_hours": 3, - "billable_stream_hours": 4, - "encoded_hours": 3, - "billable_encoded_hours": 4, - "total_hours": 6, - "total_billable_hours": 8 - }, { - "grouping": null, - "collected_on": "2011-08-10", - "stream_hours": 2, - "billable_stream_hours": 2, - "encoded_hours": 2, - "billable_encoded_hours": 2, - "total_hours": 4, - "total_billable_hours": 4 - } - ] -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - details, err := zc.GetLiveUsage(nil) - if err != nil { - t.Fatal("Expected no error", err) - } - - if details == nil { - t.Fatal("Expected details") - } - - if details.Total.StreamHours != 5 { - t.Fatal("Expected 5, got", details.Total.StreamHours) - } - if details.Total.BillableStreamHours != 6 { - t.Fatal("Expected 6, got", details.Total.BillableStreamHours) - } - if details.Total.EncodedHours != 5 { - t.Fatal("Expected 5, got", details.Total.EncodedHours) - } - if details.Total.BillableEncodedHours != 6 { - t.Fatal("Expected 6, got", details.Total.BillableEncodedHours) - } - if details.Total.TotalHours != 10 { - t.Fatal("Expected 10, got", details.Total.TotalHours) - } - if details.Total.TotalBillableHours != 12 { - t.Fatal("Expected 12, got", details.Total.TotalBillableHours) - } - - if len(details.Statistics) != 2 { - t.Fatal("Expected 2 statistics, got", len(details.Statistics)) - } - - if details.Statistics[0].Grouping != "zencoder" { - t.Fatal("Expected zencoder, got", details.Statistics[0].Grouping) - } - if details.Statistics[0].CollectedOn != "2011-08-10" { - t.Fatal("Expected 2011-08-10, got", details.Statistics[0].CollectedOn) - } - if details.Statistics[0].StreamHours != 3 { - t.Fatal("Expected 3, got", details.Statistics[0].StreamHours) - } - if details.Statistics[0].BillableStreamHours != 4 { - t.Fatal("Expected 4, got", details.Statistics[0].BillableStreamHours) - } - if details.Statistics[0].EncodedHours != 3 { - t.Fatal("Expected 3, got", details.Statistics[0].EncodedHours) - } - if details.Statistics[0].BillableEncodedHours != 4 { - t.Fatal("Expected 4, got", details.Statistics[0].BillableEncodedHours) - } - if details.Statistics[0].TotalHours != 6 { - t.Fatal("Expected 6, got", details.Statistics[0].TotalHours) - } - if details.Statistics[0].TotalBillableHours != 8 { - t.Fatal("Expected 8, got", details.Statistics[0].TotalBillableHours) - } - - expectedStatus = http.StatusInternalServerError - - details, err = zc.GetLiveUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - expectedStatus = http.StatusOK - returnBody = false - - details, err = zc.GetLiveUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - srv.Close() - returnBody = false - - details, err = zc.GetLiveUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } -} - -func TestGetUsage(t *testing.T) { - expectedStatus := http.StatusOK - returnBody := true - - mux := http.NewServeMux() - mux.HandleFunc("/reports/all", func(w http.ResponseWriter, r *http.Request) { - if expectedStatus != http.StatusOK { - w.WriteHeader(expectedStatus) - return - } - - if !returnBody { - return - } - - fmt.Fprintln(w, `{ - "total": { - "live": { - "stream_hours": 5, - "billable_stream_hours": 6, - "encoded_hours": 5, - "billable_encoded_hours": 6, - "total_hours": 10, - "total_billable_hours": 12 - }, - "vod": { - "encoded_minutes": 6, - "billable_minutes": 8 - } - }, - "statistics": { - "live": [ - { - "grouping": "zencoder", - "collected_on": "2011-08-10", - "stream_hours": 3, - "billable_stream_hours": 4, - "encoded_hours": 3, - "billable_encoded_hours": 4, - "total_hours": 6, - "total_billable_hours": 8 - }, { - "grouping": null, - "collected_on": "2011-08-10", - "stream_hours": 2, - "billable_stream_hours": 2, - "encoded_hours": 2, - "billable_encoded_hours": 2, - "total_hours": 4, - "total_billable_hours": 4 - } - ], - "vod": [ - { - "grouping": "zencoder", - "collected_on": "2011-08-10", - "encoded_minutes": 4, - "billable_minutes": 5 - }, { - "grouping": null, - "collected_on": "2011-08-10", - "encoded_minutes": 2, - "billable_minutes": 3 - } - ] - } -}`) - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - details, err := zc.GetUsage(nil) - if err != nil { - t.Fatal("Expected no error", err) - } - - if details == nil { - t.Fatal("Expected details") - } - - if details.Total.Live.StreamHours != 5 { - t.Fatal("Expected 5, got", details.Total.Live.StreamHours) - } - if details.Total.Live.BillableStreamHours != 6 { - t.Fatal("Expected 6, got", details.Total.Live.BillableStreamHours) - } - if details.Total.Live.EncodedHours != 5 { - t.Fatal("Expected 5, got", details.Total.Live.EncodedHours) - } - if details.Total.Live.BillableEncodedHours != 6 { - t.Fatal("Expected 6, got", details.Total.Live.BillableEncodedHours) - } - if details.Total.Live.TotalHours != 10 { - t.Fatal("Expected 10, got", details.Total.Live.TotalHours) - } - if details.Total.Live.TotalBillableHours != 12 { - t.Fatal("Expected 12, got", details.Total.Live.TotalBillableHours) - } - if details.Total.Vod.EncodedMinutes != 6 { - t.Fatal("Expected 6, got", details.Total.Vod.EncodedMinutes) - } - if details.Total.Vod.BillableMinutes != 8 { - t.Fatal("Expected 8, got", details.Total.Vod.BillableMinutes) - } - if len(details.Statistics.Live) != 2 { - t.Fatal("Expected 2 live stats, got", len(details.Statistics.Live)) - } - - if details.Statistics.Live[0].Grouping != "zencoder" { - t.Fatal("Expected zencoder, got", details.Statistics.Live[0].Grouping) - } - if details.Statistics.Live[0].CollectedOn != "2011-08-10" { - t.Fatal("Expected 2011-08-10, got", details.Statistics.Live[0].CollectedOn) - } - if details.Statistics.Live[0].StreamHours != 3 { - t.Fatal("Expected 3, got", details.Statistics.Live[0].StreamHours) - } - if details.Statistics.Live[0].BillableStreamHours != 4 { - t.Fatal("Expected 4, got", details.Statistics.Live[0].BillableStreamHours) - } - if details.Statistics.Live[0].EncodedHours != 3 { - t.Fatal("Expected 3, got", details.Statistics.Live[0].EncodedHours) - } - if details.Statistics.Live[0].BillableEncodedHours != 4 { - t.Fatal("Expected 4, got", details.Statistics.Live[0].BillableEncodedHours) - } - if details.Statistics.Live[0].TotalHours != 6 { - t.Fatal("Expected 6, got", details.Statistics.Live[0].TotalHours) - } - if details.Statistics.Live[0].TotalBillableHours != 8 { - t.Fatal("Expected 8, got", details.Statistics.Live[0].TotalBillableHours) - } - - if len(details.Statistics.Vod) != 2 { - t.Fatal("Expected 2 VOD stats, got", len(details.Statistics.Vod)) - } - - if details.Statistics.Vod[0].Grouping != "zencoder" { - t.Fatal("Expected zencoder, got", details.Statistics.Vod[0].Grouping) - } - if details.Statistics.Vod[0].CollectedOn != "2011-08-10" { - t.Fatal("Expected 2011-08-10, got", details.Statistics.Vod[0].CollectedOn) - } - if details.Statistics.Vod[0].EncodedMinutes != 4 { - t.Fatal("Expected 4, got", details.Statistics.Vod[0].EncodedMinutes) - } - if details.Statistics.Vod[0].BillableMinutes != 5 { - t.Fatal("Expected 5, got", details.Statistics.Vod[0].BillableMinutes) - } - - expectedStatus = http.StatusInternalServerError - - details, err = zc.GetUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - expectedStatus = http.StatusOK - returnBody = false - - details, err = zc.GetUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } - - srv.Close() - returnBody = false - - details, err = zc.GetUsage(nil) - if err == nil { - t.Fatal("Expected error") - } - - if details != nil { - t.Fatal("Expected no details", details) - } -} diff --git a/vendor/github.com/flavioribeiro/zencoder/settings.go b/vendor/github.com/flavioribeiro/zencoder/settings.go deleted file mode 100644 index 2eea9e98..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/settings.go +++ /dev/null @@ -1,269 +0,0 @@ -package zencoder - -type AccessControlSettings struct { - Grantee string `json:"grantee,omitempty"` // Set the grantee for fine-grained S3 access_control permissions. - Permission []string `json:"permission,omitempty"` // Set the permission for a grantee when using fine-grained access_control. -} - -type ThumbnailSettings struct { - Label string `json:"label,omitempty"` // A label to identify each set of thumbnail groups. - Format string `json:"format,omitempty"` // The format of the thumbnail image. - Number int32 `json:"number,omitempty"` // A number of thumbnails, evenly-spaced. - StartAtFirstFrame bool `json:"start_at_first_frame,omitempty"` // Start generating the thumbnails starting at the first frame. - Interval int32 `json:"interval,omitempty"` // Take thumbnails at an even interval, in seconds. - IntervalInFrames int32 `json:"interval_in_frames,omitempty"` // Take thumbnails at an even interval, in frames. - Times []int32 `json:"times,omitempty"` // An array of times, in seconds, at which to grab a thumbnail. - AspectMode string `json:"aspect_mode,omitempty"` // How to handle a thumbnail width/height that differs from the aspect ratio of the input file. - Size string `json:"size,omitempty"` // Thumbnail resolution as WxH. - Width int32 `json:"width,omitempty"` // The maximum width of the thumbnail (in pixels). - Height int32 `json:"height,omitempty"` // The maximum height of the thumbnail (in pixels). - BaseUrl string `json:"base_url,omitempty"` // A base S3, Cloud Files, GCS, FTP, FTPS, or SFTP directory URL where we'll place the thumbnails, without a filename. - Prefix string `json:"prefix,omitempty"` // Prefix for thumbnail filenames. - Filename string `json:"filename,omitempty"` // Interpolated thumbnail filename. - MakePublic bool `json:"public,omitempty"` // Make the output publicly readable on S3. - AccessControl []*AccessControlSettings `json:"access_control,omitempty"` // Fine-grained access control rules for files sent to S3. - UseRRS bool `json:"rrs,omitempty"` // Amazon S3's Reduced Redundancy Storage. - Headers map[string]string `json:"headers,omitempty"` // HTTP headers to send with your thumbnails when we upload them. - Credentials string `json:"credentials,omitempty"` // References saved credentials by a nickname. - ParallelUploadLimit int32 `json:"parallel_upload_limit,omitempty"` // The maximum number of simultaneous uploads to attempt. -} - -type WatermarkSettings struct { - Url string `json:"url,omitempty"` // The URL of a remote image file to use as a watermark. - X int32 `json:"x,omitempty"` // Where to place a watermark, on the x axis. - Y int32 `json:"y,omitempty"` // Where to place a watermark, on the y axis. - Width int32 `json:"width,omitempty"` // The scaled width of a watermark. - Height int32 `json:"height,omitempty"` // The scaled height of a watermark. - Origin string `json:"origin,omitempty"` // Which part of the output to base the watermark position on. - Opacity float64 `json:"opacity,omitempty"` // Make the watermark transparent. -} - -type NotificationSettings struct { - Url string `json:"url,omitempty"` // Be notified when a job or output is complete. - Format string `json:"format,omitempty"` // A format and content type for notifications. - Headers map[string]string `json:"headers,omitempty"` // Headers to pass along on HTTP notifications. - Event string `json:"event,omitempty"` // The event that triggers a notification. Used for Instant Play. -} - -type StreamSettings struct { - Source string `json:"source,omitempty"` // Specifies the label of a given source - Path string `json:"path,omitempty"` // Specifies the path to a stream manifest file - Bandwidth int32 `json:"bandwidth,omitempty"` // Specifies the bandwidth of a playlist stream - Resolution string `json:"resolution,omitempty"` // Specifies the resolution of a playlist stream - Codecs string `json:"codecs,omitempty"` // Specifies the codecs used in a playlist stream -} - -type CuePointSettings struct { - Type string `json:"type,omitempty"` // A cue point type. - Time float64 `json:"time,omitempty"` // A cue point time, in seconds. - Name string `json:"name,omitempty"` // A cue point name. - Data map[string]string `json:"data,omitempty"` // Cue point data. -} - -type OutputSettings struct { - // General Output Settings - Type string `json:"type,omitempty"` // The type of file to output. - Label string `json:"label,omitempty"` // An optional label for this output. - Url string `json:"url,omitempty"` // A S3, Cloud Files, GCS, FTP, FTPS, SFTP, Aspera, HTTP, or RTMP URL where we'll put the transcoded file. - SecondaryUrl string `json:"secondary_url,omitempty"` // A S3, Cloud Files, GCS, FTP, FTPS, SFTP, Aspera, or syndication URL where we'll put the transcoded file. - BaseUrl string `json:"base_url,omitempty"` // A base S3, Cloud Files, GCS, FTP, FTPS, SFTP, or Aspera directory URL where we'll put the transcoded file, without a filename. - Filename string `json:"filename,omitempty"` // The filename of a finished file. - PackageFilename string `json:"package_filename,omitempty"` // The filename of a packaged output. - PackageFormat string `json:"package_format,omitempty"` // Zip/packaging format to use for the output file(s). - DeviceProfile string `json:"device_profile,omitempty"` // A device profile to use for mobile device compatibility. - Strict bool `json:"strict,omitempty"` // Enable strict mode. - SkipVideo bool `json:"skip_video,omitempty"` // Do not output a video track. - SkipAudio bool `json:"skip_audio,omitempty"` // Do not output an audio track. - Source string `json:"source,omitempty"` // References a label on another job and uses the video created by that output for processing instead of the input file. - Credentials string `json:"credentials,omitempty"` // References saved credentials by a nickname. - GenerateMD5Checksum bool `json:"generate_md5_checksum,omitempty"` // Generate an MD5 checksum of the output file. - ParallelUploadLimit int32 `json:"parallel_upload_limit,omitempty"` // The maximum number of simultaneous uploads to attempt. - Headers map[string]string `json:"headers,omitempty"` // HTTP headers to send with your file when we upload it. - - // Format And Codecs - Format string `json:"format,omitempty"` // The output format to use. - VideoCodec string `json:"video_codec,omitempty"` // The video codec to use. - AudioCodec string `json:"audio_codec,omitempty"` // The audio codec to use. - - // Resolution - Size string `json:"size,omitempty"` // The resolution of the output video (WxH, in pixels). - Width int32 `json:"width,omitempty"` // The maximum width of the output video (in pixels). - Height int32 `json:"height,omitempty"` // The maximum height of the output video (in pixels). - Upscale bool `json:"upscale,omitempty"` // Upscale the output if the input is smaller than the target output resolution. - AspectMode string `json:"aspect_mode,omitempty"` // What to do when aspect ratio of input file does not match the target width/height aspect ratio. - - // Rate Control - Quality int32 `json:"quality,omitempty"` // Autoselect the best video bitrate to to match a target visual quality. - VideoBitrate int32 `json:"video_bitrate,omitempty"` // A target video bitrate in kbps. Not necessary if you select a quality setting, unless you want to target a specific bitrate. - AudioQuality int32 `json:"audio_quality,omitempty"` // Autoselect the best audio bitrate to to match a target sound quality. - AudioBitrate int32 `json:"audio_bitrate,omitempty"` // A target audio bitrate in kbps. Not necessary if you select a audio_quality setting, unless you want to target a specific bitrate. - MaxVideoBitrate int32 `json:"max_video_bitrate,omitempty"` // A maximum average bitrate. - Speed int32 `json:"speed,omitempty"` // A target transcoding speed. Slower encoding generally allows for more advanced compression. - DecoderBitrateCap int32 `json:"decoder_bitrate_cap,omitempty"` // Max bitrate fed to decoder buffer. Typically used for video intended for streaming, or for targeting specific devices (e.g. Blu-Ray). - DecoderBufferSize int32 `json:"decoder_buffer_size,omitempty"` // Size of the decoder buffer, used in conjunction with bitrate_cap. - OnePass bool `json:"one_pass,omitempty"` // Force one-pass encoding. - AudioConstantBitrate bool `json:"audio_constant_bitrate,omitempty"` // Enable constant bitrate mode for audio if possible. - - // Frame Rate - FrameRate int32 `json:"frame_rate,omitempty"` // The frame rate to use. - MaxFrameRate int32 `json:"max_frame_rate,omitempty"` // The maximum frame rate to use. - Decimate int32 `json:"decimate,omitempty"` // Reduce the input bitrate by a divisor. - KeyframeInterval int32 `json:"keyframe_interval,omitempty"` // The maximum number of frames between each keyframe. - KeyframeRate int32 `json:"keyframe_rate,omitempty"` // The number of keyframes per second. - FixedKeyframeInterval bool `json:"fixed_keyframe_interval,omitempty"` // Enable fixed keyframe interval mode (VP6 and H.264 only). - ForcedKeyframeInterval int32 `json:"forced_keyframe_interval,omitempty"` // Force keyframes at the specified interval (H.264 only). - ForcedKeyframeRate float64 `json:"forced_keyframe_rate,omitempty"` // Specify the number of keyframes per-second, taking frame rate into account (H.264 only). - - // Audio - AudioSampleRate int32 `json:"audio_sample_rate,omitempty"` // The audio sample rate, in Hz. - MaxAudioSampleRate int32 `json:"max_audio_sample_rate,omitempty"` // The max audio sample rate, in Hz. - AudioChannels int32 `json:"audio_channels,omitempty"` // The number of audio channels: 1 or 2. - - // Thumbnails - Thumbnails []*ThumbnailSettings `json:"thumbnails,omitempty"` // Capture thumbnails for a given video. - - // Watermarks - Watermarks []*WatermarkSettings `json:"watermarks,omitempty"` // Add one or more watermarks to an output video. - - // Captions - CaptionUrl string `json:"caption_url,omitempty"` // URL to an SCC, DFXP, or SAMI caption file to include in the output. - SkipCaptions bool `json:"skip_captions,omitempty"` // Don't add or pass through captions to the output file. - - // Live Streaming - LiveStream bool `json:"live_stream,omitempty"` // Create a live_stream job or output that is ready for playback within seconds. - ReconnectTime int32 `json:"reconnect_time,omitempty"` // The time, in seconds, to wait for a stream to reconnect. - EventLength int32 `json:"event_length,omitempty"` // The minimum time, in seconds, to keep a live stream available. - LiveSlidingWindowDuration int32 `json:"live_sliding_window_duration,omitempty"` // The time, in seconds, to keep in the HLS playlist. - - // Video Processing - Rotate int32 `json:"rotate,omitempty"` // Rotate a video. - Deinterlace string `json:"deinterlace,omitempty"` // Deinterlace input video. - Sharpen bool `json:"sharpen,omitempty"` // Apply a sharpen filter. - Denoise string `json:"denoise,omitempty"` // Apply denoise filter. - Autolevel bool `json:"autolevel,omitempty"` // Apply a color auto-level filter. - Deblock bool `json:"deblock,omitempty"` // Apply deblock filter. - - // Audio Processing - AudioGain int32 `json:"audio_gain,omitempty"` // Apply a gain amount to the audio, in dB. - AudioNormalize bool `json:"audio_normalize,omitempty"` // Normalize audio to 0dB. - AudioPreNormalize bool `json:"audio_pre_normalize,omitempty"` // Normalize the audio before applying expansion or compression effects. - AudioPostNormalize bool `json:"audio_post_normalize,omitempty"` // Normalize the audio after applying expansion or compression effects. - AudioBass int32 `json:"audio_bass,omitempty"` // Increase or decrease the amount of bass in the audio. - AudioTreble int32 `json:"audio_treble,omitempty"` // Increase or decrease the amount of treble in the audio. - AudioHighpass int32 `json:"audio_highpass,omitempty"` // Apply a high-pass filter to the audio. - AudioLowpass int32 `json:"audio_lowpass,omitempty"` // Apply a low-pass filter to the audio. - AudioCompressionRatio float64 `json:"audio_compression_ratio,omitempty"` // Compress the dynamic range of the audio. - AudioCompressionThreshold int32 `json:"audio_compression_threshold,omitempty"` // Compress the dynamic range of the audio. - AudioExpansionRatio float64 `json:"audio_expansion_ratio,omitempty"` // Expand the dynamic range of the audio. - AudioExpansionThreshold int32 `json:"audio_expansion_threshold,omitempty"` // Expand the dynamic range of the audio. - AudioFade float64 `json:"audio_fade,omitempty"` // Apply fade-in and fade-out effects to the audio. - AudioFadeIn float64 `json:"audio_fade_in,omitempty"` // Apply a fade-in effect to the audio. - AudioFadeOut float64 `json:"audio_fade_out,omitempty"` // Apply a fade-out effect to the audio. - AudioKaraokeMode bool `json:"audio_karaoke_mode,omitempty"` // Apply a karaoke effect to the audio. - - // Clips - StartClip string `json:"start_clip,omitempty"` // Encode only a portion of the input file by setting a custom start time. - ClipLength string `json:"clip_length,omitempty"` // Encode only a portion of the input file by setting a custom clip length. - - // S3 Settings - MakePublic bool `json:"public,omitempty"` // Make the output publicly readable on S3. - UseRRS bool `json:"rrs,omitempty"` // Amazon S3's Reduced Redundancy Storage. - AccessControl []*AccessControlSettings `json:"access_control,omitempty"` // Fine-grained access control rules for files sent to S3. - - // Notifications - Notifications []*NotificationSettings `json:"notifications,omitempty"` // Be notified when a job or output is complete. - - // Conditional Outputs - MinSize string `json:"min_size,omitempty"` // Skip output if the input file is smaller than the given dimensions. - MaxSize string `json:"max_size,omitempty"` // Skip output if the input file is larger than the given dimensions. - MinDuration int32 `json:"min_duration,omitempty"` // Skip output if the input file is shorter than the given duration, in seconds. - MaxDuration int32 `json:"max_duration,omitempty"` // Skip output if the input file is longer than the given duration, in seconds. - - // Segmented Streaming - SegmentSeconds int32 `json:"segment_seconds,omitempty"` // Sets the maximum duration of each segment a segmented output - SegmentSize int32 `json:"segment_size,omitempty"` // Sets the maximum data size of each segment in a segmented output - Streams []*StreamSettings `json:"streams,omitempty"` // Provides a list of stream info to be reformatted as a playlist - SegmentImageUrl string `json:"segment_image_url,omitempty"` // An image to display on audio-only segments - SegmentVideoSnapshots bool `json:"segment_video_snapshots,omitempty"` // When segmenting a video file into audio-only segments, take snapshots of the video as thumbnails for each segment. - MaxHLSProtocolVersion int32 `json:"max_hls_protocol_version,omitempty"` // The maximum HLS protocol to use. - HLSOptimizedTS bool `json:"hls_optimized_ts,omitempty"` // Optimize TS segment files for HTTP Live Streaming on iOS. - PrepareForSegmenting string `json:"prepare_for_segmenting,omitempty"` // Include captions and keyframe timing for segmenting. - InstantPlay bool `json:"instant_play,omitempty"` // Create an instant play output that is ready for playback within seconds. - SMILBaseUrl string `json:"smil_base_url,omitempty"` // Add to the section of an SMIL playlist. - - // Encryption - EncryptionMethod string `json:"encryption_method,omitempty"` // Set the encryption method to use for encrypting. - EncryptionKey string `json:"encryption_key,omitempty"` // Set a single encryption key to use rather than having Zencoder generate one - EncryptionKeyUrl string `json:"encryption_key_url,omitempty"` // Set a URL to a single encryption key to use rather than having Zencoder generate one - EncryptionKeyRotationPeriod int32 `json:"encryption_key_rotation_period,omitempty"` // Rotate to a new encryption key after a number of segments - EncryptionKeyUrlPrefix string `json:"encryption_key_url_prefix,omitempty"` // Prepend key URLs with the passed string - EncryptionIV string `json:"encryption_iv,omitempty"` // Set an initialization vector to use when encrypting - EncryptionPassword string `json:"encryption_password,omitempty"` // Sets a password to use for generating an initialization vector - - // Decryption - DecryptionMethod string `json:"decryption_method,omitempty"` // Set the decryption algorithm to use. - DecryptionKey string `json:"decryption_key,omitempty"` // Set the decryption key to use. - DecryptionKeyUrl string `json:"decryption_key_url,omitempty"` // The URL of a decryption key file to use. - DecryptionPassword string `json:"decryption_password,omitempty"` // The password used in combination with the key to decrypt the input file. - - // H.264 - H264ReferenceFrames int32 `json:"h264_reference_frames,omitempty"` // A number of reference frames to use in H.264 video. - H264Profile string `json:"h264_profile,omitempty"` // The H.264 profile to use. - H264Level string `json:"h264_level,omitempty"` // The H.264 level to use. - H264Bframes int32 `json:"h264_bframes,omitempty"` // The maximum number of consecutive B-frames. - Tuning string `json:"tuning,omitempty"` // Tune the output video for a specific content type. - Crf int32 `json:"crf,omitempty"` // Bitrate control setting. - - // FLV - CuePoints []*CuePointSettings `json:"cue_points,omitempty"` // Add event or navigation cue points to a FLV video. - - // VP6 - VP6TemporalDownWatermark int32 `json:"vp6_temporal_down_watermark,omitempty"` // VP6 temporal down watermark percentage. - VP6TemporalResampling bool `json:"vp6_temporal_resampling,omitempty"` // Enable or disable VP6 temporal resampling. - VP6UndershootPct int32 `json:"vp6_undershoot_pct,omitempty"` // Target a slightly lower datarate. - VP6Profile string `json:"vp6_profile,omitempty"` // VP6 profile: vp6s or vp6e. - VP6CompressionMode string `json:"vp6_compression_mode,omitempty"` // VP6 compression mode: good or best. - VP6TwoPassMinSection int32 `json:"vp6_2pass_min_section,omitempty"` // For two-pass VBR encoding, the lowest datarate that the encoder will allow. - VP6TwoPassMaxSection int32 `json:"vp6_2pass_max_section,omitempty"` // For two-pass VBR encoding, the highest datarate that the encoder will allow. - VP6StreamPrebuffer int32 `json:"vp6_stream_prebuffer,omitempty"` // Seconds of preload that are necessary before starting playback. - VP6StreamMaxBuffer int32 `json:"vp6_stream_max_buffer,omitempty"` // Maximum decoder buffer size - VP6DeinterlaceMode string `json:"vp6_deinterlace_mode,omitempty"` // Deinterlace mode for VP6 - VP6DenoiseLevel float64 `json:"vp6_denoise_level,omitempty"` // Denoise level for VP6 - AlphaTransparency bool `json:"alpha_transparency,omitempty"` // Enable alpha transparency. Currently, only supported by VP6. - ConstantBitrate bool `json:"constant_bitrate,omitempty"` // Use constant bitrate (CBR) encoding. - - // MP4 - Hint bool `json:"hint,omitempty"` // Enable hinting of MP4 files for RTP/RTSP. - MTUSize int32 `json:"mtu_size,omitempty"` // Set MTU size for MP4 hinting. - - // AAC - MaxAacProfile string `json:"max_aac_profile,omitempty"` // What is the most advanced (compressed) AAC profile to allow? - ForceAacProfile string `json:"force_aac_profile,omitempty"` // Force the use of a particular AAC profile, rather than letting Zencoder choose the best profile for the bitrate. - - // Aspera - AsperaTransferPolicy string `json:"aspera_transfer_policy,omitempty"` // How to allocate available bandwidth for Aspera file transfers. - TransferMinimumRate int32 `json:"transfer_minimum_rate,omitempty"` // A targeted rate in Kbps for data transfer minimums. - TransferMaximumRate int32 `json:"transfer_maximum_rate,omitempty"` // A targeted rate in Kbps for data transfer maximums. - - // Transmuxing - CopyVideo bool `json:"copy_video,omitempty"` // Copy the video track of the input file - CopyAudio bool `json:"copy_audio,omitempty"` // Copy the audio track of the input file -} - -type EncodingSettings struct { - Input string `json:"input,omitempty"` // A S3, Cloud Files, GCS, FTP, FTPS, SFTP, or Aspera URL where we can download file to transcode. - LiveStream bool `json:"live_stream,omitempty"` // Create a Live streaming job. - Outputs []*OutputSettings `json:"outputs,omitempty"` // An array or hash of output settings. - Region string `json:"region,omitempty"` // The region where a file is processed: US, Europe, Asia, or Australia. - Test bool `json:"test,omitempty"` // Enable test mode ("Integration Mode") for a job. - Private bool `json:"private,omitempty"` // Enable privacy mode for a job. - DownloadConnections int32 `json:"download_connections,omitempty"` // Utilize multiple, simultaneous connections for download acceleration (in some circumstances). - PassThrough string `json:"pass_through,omitempty"` // Optional information to store alongside this job. - Mock bool `json:"mock,omitempty"` // Send a mocked job request. - Grouping string `json:"grouping,omitempty"` // A report grouping for this job. - AsperaTransferPolicy string `json:"aspera_transfer_policy,omitempty"` // How to allocate available bandwidth for Aspera file transfers. - TransferMinimumRate int32 `json:"transfer_minimum_rate,omitempty"` // A targeted rate in Kbps for data transfer minimums. - TransferMaximumRate int32 `json:"transfer_maximum_rate,omitempty"` // A targeted rate in Kbps for data transfer maximums. - ExpectedMD5Checksum string `json:"expected_md5_checksum,omitempty"` // The expected checksum of the input file. - Credentials string `json:"credentials,omitempty"` // References saved credentials by a nickname. -} diff --git a/vendor/github.com/flavioribeiro/zencoder/zencoder.go b/vendor/github.com/flavioribeiro/zencoder/zencoder.go deleted file mode 100644 index 12daed4d..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/zencoder.go +++ /dev/null @@ -1,108 +0,0 @@ -package zencoder - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "io/ioutil" - "net/http" -) - -type Zencoder struct { - BaseUrl string - Header http.Header - Client *http.Client -} - -func NewZencoder(apiKey string) *Zencoder { - return &Zencoder{ - Client: http.DefaultClient, - BaseUrl: "https://app.zencoder.com/api/v2/", - Header: http.Header{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Zencoder-Api-Key": []string{apiKey}, - "User-Agent": []string{"gozencoder v1"}, - }, - } -} - -func (z *Zencoder) call(method, path string, request interface{}, expectedStatus []int) (*http.Response, error) { - var buffer io.Reader - if request != nil { - b, err := json.Marshal(request) - if err != nil { - return nil, err - } - - buffer = bytes.NewBuffer(b) - } - - req, err := http.NewRequest(method, fmt.Sprintf("%s/%s", z.BaseUrl, path), buffer) - if err != nil { - return nil, err - } - - req.Header = z.Header - - resp, err := z.Client.Do(req) - if err != nil { - return resp, err - } - - for _, status := range expectedStatus { - if resp.StatusCode == status { - return resp, err - } - } - - return nil, errors.New(resp.Status) -} - -func (z *Zencoder) post(path string, request interface{}, response interface{}) error { - resp, err := z.call("POST", path, request, []int{http.StatusCreated, http.StatusOK}) - if err != nil { - return err - } - - if err := UnmarshalBody(resp.Body, response); err != nil { - return err - } - - return nil -} - -func (z *Zencoder) putNoContent(path string) error { - _, err := z.call("PUT", path, nil, []int{http.StatusNoContent}) - if err != nil { - return err - } - - return nil -} - -func (z *Zencoder) getBody(path string, response interface{}) error { - resp, err := z.call("GET", path, nil, []int{http.StatusOK}) - if err != nil { - return err - } - - if err := UnmarshalBody(resp.Body, response); err != nil { - return err - } - - return nil -} - -func UnmarshalBody(body io.ReadCloser, result interface{}) error { - defer body.Close() - - b, err := ioutil.ReadAll(body) - if err != nil { - return err - } - - return json.Unmarshal(b, result) -} diff --git a/vendor/github.com/flavioribeiro/zencoder/zencoder_test.go b/vendor/github.com/flavioribeiro/zencoder/zencoder_test.go deleted file mode 100644 index dfaa5a15..00000000 --- a/vendor/github.com/flavioribeiro/zencoder/zencoder_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package zencoder - -import ( - "net/http" - "net/http/httptest" - "testing" -) - -func TestGenericCall(t *testing.T) { - var headers http.Header - - mux := http.NewServeMux() - mux.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) { - headers = r.Header - }) - - srv := httptest.NewServer(mux) - - zc := NewZencoder("abc") - zc.BaseUrl = srv.URL - - resp, err := zc.call("GET", "test", nil, []int{http.StatusOK}) - if err != nil { - t.Fatal("Expected no error", err) - } - - if resp == nil { - t.Fatal("Expected a response") - } - - if len(headers) == 0 { - t.Fatal("Expected headers") - } - - if len(headers["User-Agent"]) == 0 { - t.Fatal("Expected User-Agent") - } - - if headers["User-Agent"][0] != "gozencoder v1" { - t.Fatal("Expected User-Agent=gozencoder v1", headers["User-Agent"]) - } - - if len(headers["Accept"]) == 0 { - t.Fatal("Expected Accept") - } - - if headers["Accept"][0] != "application/json" { - t.Fatal("Expected Accept=application/json", headers["Accept"]) - } - - if len(headers["Content-Type"]) == 0 { - t.Fatal("Expected Content-Type") - } - - if headers["Content-Type"][0] != "application/json" { - t.Fatal("Expected Content-Type=application/json", headers["Content-Type"]) - } - - if len(headers["Zencoder-Api-Key"]) == 0 { - t.Fatal("Expected Zencoder-Api-Key") - } - - if headers["Zencoder-Api-Key"][0] != "abc" { - t.Fatal("Expected Zencoder-Api-Key=abc", headers["Zencoder-Api-Key"]) - } -} diff --git a/vendor/github.com/fluent/fluent-logger-golang/.gitignore b/vendor/github.com/fluent/fluent-logger-golang/.gitignore deleted file mode 100644 index 378e97dd..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -*~ -.project -.settings \ No newline at end of file diff --git a/vendor/github.com/fluent/fluent-logger-golang/.travis.yml b/vendor/github.com/fluent/fluent-logger-golang/.travis.yml deleted file mode 100644 index 432d9287..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go -go: - - 1.3 - - 1.4 - - 1.5 - - tip -install: - - go get github.com/bmizerany/assert - - go get github.com/philhofer/fwd - - go get github.com/tinylib/msgp -sudo: false -matrix: - allow_failures: - - go: tip diff --git a/vendor/github.com/fluent/fluent-logger-golang/CHANGELOG.md b/vendor/github.com/fluent/fluent-logger-golang/CHANGELOG.md deleted file mode 100644 index 42675c0a..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/CHANGELOG.md +++ /dev/null @@ -1,45 +0,0 @@ -# CHANGELOG - -## 1.2.1 -* Fix a bug not to reconnect to destination twice or more -* Fix to connect on background goroutine in async mode - -## 1.2.0 -* Add `MarshalAsJSON` feature for `message` objects which can be marshaled as JSON -* Fix a bug to panic for destination system outage - -## 1.1.0 - * Add support for unix domain socket - * Add asynchronous client creation - -## 1.0.0 - * Fix API of `Post` and `PostWithTime` to return error when encoding - * Add argument checks to get `map` with string keys and `struct` only - * Logger refers tags (`msg` or `codec`) of fields of struct - -## 0.6.0 - * Change dependency from ugorji/go/codec to tinylib/msgp - * Add `PostRawData` method to post pre-encoded data to servers - -## 0.5.1 - * Lock when writing pending buffers (Thanks @eagletmt) - -## 0.5.0 - * Add TagPrefix in Config (Thanks @hotchpotch) - -## 0.4.4 - * Fixes runtime error of close function.(Thanks @y-matsuwitter) - -## 0.4.3 - * Added method PostWithTime(Thanks [@choplin]) - -## 0.4.2 - * Use sync.Mutex - * Fix BufferLimit comparison - * Export toMsgpack function to utils.go - -## 0.4.1 - * Remove unused fmt.Println - -## 0.4.0 - * Update msgpack library ("github.com/ugorji/go-msgpack" -> "github.com/ugorji/go/codec") diff --git a/vendor/github.com/fluent/fluent-logger-golang/LICENSE b/vendor/github.com/fluent/fluent-logger-golang/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/fluent/fluent-logger-golang/README.md b/vendor/github.com/fluent/fluent-logger-golang/README.md deleted file mode 100644 index a6b9902e..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/README.md +++ /dev/null @@ -1,65 +0,0 @@ -fluent-logger-golang -==== - -[![Build Status](https://travis-ci.org/fluent/fluent-logger-golang.png?branch=master)](https://travis-ci.org/fluent/fluent-logger-golang) - -## A structured event logger for Fluentd (Golang) - -## How to install - -``` -go get github.com/fluent/fluent-logger-golang/fluent -``` - -## Usage - -Install the package with `go get` and use `import` to include it in your project. - -``` -import "github.com/fluent/fluent-logger-golang/fluent" -``` - -GoDoc: http://godoc.org/github.com/fluent/fluent-logger-golang/fluent - -##Example - -```go -package main - -import ( - "github.com/fluent/fluent-logger-golang/fluent" - "fmt" - "time" -) - -func main() { - logger, err := fluent.New(fluent.Config{}) - if err != nil { - fmt.Println(err) - } - defer logger.Close() - tag := "myapp.access" - var data = map[string]string{ - "foo": "bar", - "hoge": "hoge", - } - error := logger.Post(tag, data) - // error := logger.Post(tag, time.Time.Now(), data) - if error != nil { - panic(error) - } -} -``` - -`data` must be a value like `map[string]literal`, `map[string]interface{}` or `struct`. Logger refers tags `msg` or `codec` of each fields of structs. - -## Setting config values - -```go -f := fluent.New(fluent.Config{FluentPort: 80, FluentHost: "example.com"}) -``` - -## Tests -``` -go test -``` diff --git a/vendor/github.com/fluent/fluent-logger-golang/fluent/fluent.go b/vendor/github.com/fluent/fluent-logger-golang/fluent/fluent.go deleted file mode 100644 index 655f6233..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/fluent/fluent.go +++ /dev/null @@ -1,309 +0,0 @@ -package fluent - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "math" - "net" - "reflect" - "strconv" - "sync" - "time" -) - -const ( - defaultHost = "127.0.0.1" - defaultNetwork = "tcp" - defaultSocketPath = "" - defaultPort = 24224 - defaultTimeout = 3 * time.Second - defaultBufferLimit = 8 * 1024 * 1024 - defaultRetryWait = 500 - defaultMaxRetry = 13 - defaultReconnectWaitIncreRate = 1.5 -) - -type Config struct { - FluentPort int `json:"fluent_port"` - FluentHost string `json:"fluent_host"` - FluentNetwork string `json:"fluent_network"` - FluentSocketPath string `json:"fluent_socket_path"` - Timeout time.Duration `json:"timeout"` - BufferLimit int `json:"buffer_limit"` - RetryWait int `json:"retry_wait"` - MaxRetry int `json:"max_retry"` - TagPrefix string `json:"tag_prefix"` - AsyncConnect bool `json:"async_connect"` - MarshalAsJSON bool `json:"marshal_as_json"` -} - -type Fluent struct { - Config - - mubuff sync.Mutex - pending []byte - - muconn sync.Mutex - conn io.WriteCloser - reconnecting bool -} - -// New creates a new Logger. -func New(config Config) (f *Fluent, err error) { - if config.FluentNetwork == "" { - config.FluentNetwork = defaultNetwork - } - if config.FluentHost == "" { - config.FluentHost = defaultHost - } - if config.FluentPort == 0 { - config.FluentPort = defaultPort - } - if config.FluentSocketPath == "" { - config.FluentSocketPath = defaultSocketPath - } - if config.Timeout == 0 { - config.Timeout = defaultTimeout - } - if config.BufferLimit == 0 { - config.BufferLimit = defaultBufferLimit - } - if config.RetryWait == 0 { - config.RetryWait = defaultRetryWait - } - if config.MaxRetry == 0 { - config.MaxRetry = defaultMaxRetry - } - if config.AsyncConnect { - f = &Fluent{Config: config, reconnecting: true} - go f.reconnect() - } else { - f = &Fluent{Config: config, reconnecting: false} - err = f.connect() - } - return -} - -// Post writes the output for a logging event. -// -// Examples: -// -// // send string -// f.Post("tag_name", "data") -// -// // send map[string] -// mapStringData := map[string]string{ -// "foo": "bar", -// } -// f.Post("tag_name", mapStringData) -// -// // send message with specified time -// mapStringData := map[string]string{ -// "foo": "bar", -// } -// tm := time.Now() -// f.PostWithTime("tag_name", tm, mapStringData) -// -// // send struct -// structData := struct { -// Name string `msg:"name"` -// } { -// "john smith", -// } -// f.Post("tag_name", structData) -// -func (f *Fluent) Post(tag string, message interface{}) error { - timeNow := time.Now() - return f.PostWithTime(tag, timeNow, message) -} - -func (f *Fluent) PostWithTime(tag string, tm time.Time, message interface{}) error { - if len(f.TagPrefix) > 0 { - tag = f.TagPrefix + "." + tag - } - - msg := reflect.ValueOf(message) - msgtype := msg.Type() - - if msgtype.Kind() == reflect.Struct { - // message should be tagged by "codec" or "msg" - kv := make(map[string]interface{}) - fields := msgtype.NumField() - for i := 0; i < fields; i++ { - field := msgtype.Field(i) - name := field.Name - if n1 := field.Tag.Get("msg"); n1 != "" { - name = n1 - } else if n2 := field.Tag.Get("codec"); n2 != "" { - name = n2 - } - kv[name] = msg.FieldByIndex(field.Index).Interface() - } - return f.EncodeAndPostData(tag, tm, kv) - } - - if msgtype.Kind() != reflect.Map { - return errors.New("fluent#PostWithTime: message must be a map") - } else if msgtype.Key().Kind() != reflect.String { - return errors.New("fluent#PostWithTime: map keys must be strings") - } - - kv := make(map[string]interface{}) - for _, k := range msg.MapKeys() { - kv[k.String()] = msg.MapIndex(k).Interface() - } - - return f.EncodeAndPostData(tag, tm, kv) -} - -func (f *Fluent) EncodeAndPostData(tag string, tm time.Time, message interface{}) error { - var data []byte - var err error - if data, err = f.EncodeData(tag, tm, message); err != nil { - return fmt.Errorf("fluent#EncodeAndPostData: can't convert '%#v' to msgpack:%v", message, err) - } - return f.postRawData(data) -} - -// Deprecated: Use EncodeAndPostData instead -func (f *Fluent) PostRawData(data []byte) { - f.postRawData(data) -} - -func (f *Fluent) postRawData(data []byte) error { - if err := f.appendBuffer(data); err != nil { - return err - } - if err := f.send(); err != nil { - f.close() - return err - } - return nil -} - -// For sending forward protocol adopted JSON -type MessageChunk struct { - message Message -} - -// Golang default marshaler does not support -// ["value", "value2", {"key":"value"}] style marshaling. -// So, it should write JSON marshaler by hand. -func (chunk *MessageChunk) MarshalJSON() ([]byte, error) { - data, err := json.Marshal(chunk.message.Record) - return []byte(fmt.Sprintf("[\"%s\",%d,%s,null]", chunk.message.Tag, - chunk.message.Time, data)), err -} - -func (f *Fluent) EncodeData(tag string, tm time.Time, message interface{}) (data []byte, err error) { - timeUnix := tm.Unix() - if f.Config.MarshalAsJSON { - msg := Message{Tag: tag, Time: timeUnix, Record: message} - chunk := &MessageChunk{message: msg} - data, err = json.Marshal(chunk) - } else { - msg := &Message{Tag: tag, Time: timeUnix, Record: message} - data, err = msg.MarshalMsg(nil) - } - return -} - -// Close closes the connection. -func (f *Fluent) Close() (err error) { - if len(f.pending) > 0 { - err = f.send() - } - f.close() - return -} - -// appendBuffer appends data to buffer with lock. -func (f *Fluent) appendBuffer(data []byte) error { - f.mubuff.Lock() - defer f.mubuff.Unlock() - if len(f.pending)+len(data) > f.Config.BufferLimit { - return errors.New(fmt.Sprintf("fluent#appendBuffer: Buffer full, limit %v", f.Config.BufferLimit)) - } - f.pending = append(f.pending, data...) - return nil -} - -// close closes the connection. -func (f *Fluent) close() { - f.muconn.Lock() - if f.conn != nil { - f.conn.Close() - f.conn = nil - } - f.muconn.Unlock() -} - -// connect establishes a new connection using the specified transport. -func (f *Fluent) connect() (err error) { - f.muconn.Lock() - defer f.muconn.Unlock() - - switch f.Config.FluentNetwork { - case "tcp": - f.conn, err = net.DialTimeout(f.Config.FluentNetwork, f.Config.FluentHost+":"+strconv.Itoa(f.Config.FluentPort), f.Config.Timeout) - case "unix": - f.conn, err = net.DialTimeout(f.Config.FluentNetwork, f.Config.FluentSocketPath, f.Config.Timeout) - default: - err = net.UnknownNetworkError(f.Config.FluentNetwork) - } - - if err == nil { - f.reconnecting = false - } - return -} - -func e(x, y float64) int { - return int(math.Pow(x, y)) -} - -func (f *Fluent) reconnect() { - for i := 0; ; i++ { - err := f.connect() - if err == nil { - f.send() - return - } - if i == f.Config.MaxRetry { - // TODO: What we can do when connection failed MaxRetry times? - panic("fluent#reconnect: failed to reconnect!") - } - waitTime := f.Config.RetryWait * e(defaultReconnectWaitIncreRate, float64(i-1)) - time.Sleep(time.Duration(waitTime) * time.Millisecond) - } -} - -func (f *Fluent) send() error { - f.muconn.Lock() - defer f.muconn.Unlock() - - if f.conn == nil { - if f.reconnecting == false { - f.reconnecting = true - go f.reconnect() - } - return errors.New("fluent#send: can't send logs, client is reconnecting") - } - - f.mubuff.Lock() - defer f.mubuff.Unlock() - - var err error - if len(f.pending) > 0 { - _, err = f.conn.Write(f.pending) - if err != nil { - f.conn.Close() - f.conn = nil - } else { - f.pending = f.pending[:0] - } - } - return err -} diff --git a/vendor/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go b/vendor/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go deleted file mode 100644 index 4254181b..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go +++ /dev/null @@ -1,412 +0,0 @@ -package fluent - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "net" - "reflect" - "runtime" - "testing" - "time" - - "github.com/bmizerany/assert" -) - -const ( - RECV_BUF_LEN = 1024 -) - -// Conn is io.WriteCloser -type Conn struct { - bytes.Buffer -} - -func (c *Conn) Close() error { - return nil -} - -func init() { - numProcs := runtime.NumCPU() - if numProcs < 2 { - numProcs = 2 - } - runtime.GOMAXPROCS(numProcs) - - listener, err := net.Listen("tcp", "0.0.0.0:6666") - if err != nil { - println("error listening:", err.Error()) - } - go func() { - for { - conn, err := listener.Accept() - if err != nil { - println("Error accept:", err.Error()) - return - } - go EchoFunc(conn) - } - }() -} - -func EchoFunc(conn net.Conn) { - for { - buf := make([]byte, RECV_BUF_LEN) - n, err := conn.Read(buf) - if err != nil { - println("Error reading:", err.Error()) - return - } - println("received ", n, " bytes of data =", string(buf)) - } -} - -func Test_New_itShouldUseDefaultConfigValuesIfNoOtherProvided(t *testing.T) { - f, _ := New(Config{}) - assert.Equal(t, f.Config.FluentPort, defaultPort) - assert.Equal(t, f.Config.FluentHost, defaultHost) - assert.Equal(t, f.Config.Timeout, defaultTimeout) - assert.Equal(t, f.Config.BufferLimit, defaultBufferLimit) - assert.Equal(t, f.Config.FluentNetwork, defaultNetwork) - assert.Equal(t, f.Config.FluentSocketPath, defaultSocketPath) -} - -func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("windows not supported") - } - socketFile := "/tmp/fluent-logger-golang.sock" - network := "unix" - l, err := net.Listen(network, socketFile) - if err != nil { - t.Error(err) - return - } - defer l.Close() - - f, err := New(Config{ - FluentNetwork: network, - FluentSocketPath: socketFile}) - if err != nil { - t.Error(err) - return - } - defer f.Close() - assert.Equal(t, f.Config.FluentNetwork, network) - assert.Equal(t, f.Config.FluentSocketPath, socketFile) - - socketFile = "/tmp/fluent-logger-golang-xxx.sock" - network = "unixxxx" - fUnknown, err := New(Config{ - FluentNetwork: network, - FluentSocketPath: socketFile}) - if _, ok := err.(net.UnknownNetworkError); !ok { - t.Errorf("err type: %T", err) - } - if err == nil { - t.Error(err) - fUnknown.Close() - return - } -} - -func Test_New_itShouldUseConfigValuesFromArguments(t *testing.T) { - f, _ := New(Config{FluentPort: 6666, FluentHost: "foobarhost"}) - assert.Equal(t, f.Config.FluentPort, 6666) - assert.Equal(t, f.Config.FluentHost, "foobarhost") -} - -func Test_New_itShouldUseConfigValuesFromMashalAsJSONArgument(t *testing.T) { - f, _ := New(Config{MarshalAsJSON: true}) - assert.Equal(t, f.Config.MarshalAsJSON, true) -} - -func Test_send_WritePendingToConn(t *testing.T) { - f := &Fluent{Config: Config{}, reconnecting: false} - - buf := &Conn{} - f.conn = buf - - msg := "This is test writing." - bmsg := []byte(msg) - f.pending = append(f.pending, bmsg...) - - err := f.send() - if err != nil { - t.Error(err) - } - - rcv := buf.String() - if rcv != msg { - t.Errorf("got %s, except %s", rcv, msg) - } -} - -func Test_MarshalAsMsgpack(t *testing.T) { - f := &Fluent{Config: Config{}, reconnecting: false} - - buf := &Conn{} - f.conn = buf - - tag := "tag" - var data = map[string]string{ - "foo": "bar", - "hoge": "hoge"} - tm := time.Unix(1267867237, 0) - result, err := f.EncodeData(tag, tm, data) - - if err != nil { - t.Error(err) - } - actual := string(result) - - // map entries are disordered in golang - expected1 := "\x94\xA3tag\xD2K\x92\u001Ee\x82\xA3foo\xA3bar\xA4hoge\xA4hoge\xC0" - expected2 := "\x94\xA3tag\xD2K\x92\u001Ee\x82\xA4hoge\xA4hoge\xA3foo\xA3bar\xC0" - if actual != expected1 && actual != expected2 { - t.Errorf("got %x,\n except %x\n or %x", actual, expected1, expected2) - } -} - -func Test_MarshalAsJSON(t *testing.T) { - f := &Fluent{Config: Config{MarshalAsJSON: true}, reconnecting: false} - - buf := &Conn{} - f.conn = buf - - var data = map[string]string{ - "foo": "bar", - "hoge": "hoge"} - tm := time.Unix(1267867237, 0) - result, err := f.EncodeData("tag", tm, data) - - if err != nil { - t.Error(err) - } - // json.Encode marshals map keys in the order, so this expectation is safe - expected := `["tag",1267867237,{"foo":"bar","hoge":"hoge"},null]` - actual := string(result) - if actual != expected { - t.Errorf("got %s, except %s", actual, expected) - } -} - -func TestJsonConfig(t *testing.T) { - b, err := ioutil.ReadFile(`testdata/config.json`) - if err != nil { - t.Error(err) - } - var got Config - expect := Config{ - FluentPort: 8888, - FluentHost: "localhost", - FluentNetwork: "tcp", - FluentSocketPath: "/var/tmp/fluent.sock", - Timeout: 3000, - BufferLimit: 200, - RetryWait: 5, - MaxRetry: 3, - TagPrefix: "fluent", - AsyncConnect: false, - MarshalAsJSON: true, - } - - err = json.Unmarshal(b, &got) - if err != nil { - t.Error(err) - } - - if !reflect.DeepEqual(expect, got) { - t.Errorf("got %v, except %v", got, expect) - } -} - -func TestAsyncConnect(t *testing.T) { - type result struct { - f *Fluent - err error - } - ch := make(chan result, 1) - go func() { - config := Config{ - FluentPort: 8888, - AsyncConnect: true, - } - f, err := New(config) - ch <- result{f: f, err: err} - }() - - select { - case res := <-ch: - if res.err != nil { - t.Errorf("fluent.New() failed with %#v", res.err) - return - } - res.f.Close() - case <-time.After(time.Millisecond * 500): - t.Error("AsyncConnect must not block") - } -} - -func Benchmark_PostWithShortMessage(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := map[string]string{"message": "Hello World"} - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_PostWithShortMessageMarshalAsJSON(b *testing.B) { - b.StopTimer() - f, err := New(Config{MarshalAsJSON: true}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := map[string]string{"message": "Hello World"} - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_LogWithChunks(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := map[string]string{"msg": "sdfsdsdfdsfdsddddfsdfsdsdfdsfdsddddfsdfsdsdfdsfdsddddfsdfsdsdfdsfdsddddfsdfsdsdfdsfdsddddfsdfsdsdfdsfdsddddfsdfsdsdfdsfdsddddfsdfsdsdfdsfdsddddf"} - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_PostWithStruct(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := struct { - Name string `msg:"msgnamename"` - }{ - "john smith", - } - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_PostWithStructTaggedAsCodec(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := struct { - Name string `codec:"codecname"` - }{ - "john smith", - } - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_PostWithStructWithoutTag(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := struct { - Name string - }{ - "john smith", - } - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_PostWithMapString(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := map[string]string{ - "foo": "bar", - } - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_PostWithMapSlice(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := map[string][]int{ - "foo": {1, 2, 3}, - } - for i := 0; i < b.N; i++ { - if err := f.Post("tag", data); err != nil { - panic(err) - } - } -} - -func Benchmark_PostWithMapStringAndTime(b *testing.B) { - b.StopTimer() - f, err := New(Config{}) - if err != nil { - panic(err) - } - - b.StartTimer() - data := map[string]string{ - "foo": "bar", - } - tm := time.Now() - for i := 0; i < b.N; i++ { - if err := f.PostWithTime("tag", tm, data); err != nil { - panic(err) - } - } -} diff --git a/vendor/github.com/fluent/fluent-logger-golang/fluent/proto.go b/vendor/github.com/fluent/fluent-logger-golang/fluent/proto.go deleted file mode 100644 index 268d614d..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/fluent/proto.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:generate msgp - -package fluent - -//msgp:tuple Entry -type Entry struct { - Time int64 `msg:"time"` - Record interface{} `msg:"record"` -} - -//msgp:tuple Forward -type Forward struct { - Tag string `msg:"tag"` - Entries []Entry `msg:"entries"` - Option interface{} `msg:"option"` -} - -//msgp:tuple Message -type Message struct { - Tag string `msg:"tag"` - Time int64 `msg:"time"` - Record interface{} `msg:"record"` - Option interface{} `msg:"option"` -} diff --git a/vendor/github.com/fluent/fluent-logger-golang/fluent/proto_gen.go b/vendor/github.com/fluent/fluent-logger-golang/fluent/proto_gen.go deleted file mode 100644 index afb9d6d3..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/fluent/proto_gen.go +++ /dev/null @@ -1,372 +0,0 @@ -package fluent - -// NOTE: THIS FILE WAS PRODUCED BY THE -// MSGP CODE GENERATION TOOL (github.com/tinylib/msgp) -// DO NOT EDIT - -import ( - "github.com/tinylib/msgp/msgp" -) - -// DecodeMsg implements msgp.Decodable -func (z *Entry) DecodeMsg(dc *msgp.Reader) (err error) { - var ssz uint32 - ssz, err = dc.ReadArrayHeader() - if err != nil { - return - } - if ssz != 2 { - err = msgp.ArrayError{Wanted: 2, Got: ssz} - return - } - z.Time, err = dc.ReadInt64() - if err != nil { - return - } - z.Record, err = dc.ReadIntf() - if err != nil { - return - } - return -} - -// EncodeMsg implements msgp.Encodable -func (z Entry) EncodeMsg(en *msgp.Writer) (err error) { - err = en.WriteArrayHeader(2) - if err != nil { - return - } - err = en.WriteInt64(z.Time) - if err != nil { - return - } - err = en.WriteIntf(z.Record) - if err != nil { - return - } - return -} - -// MarshalMsg implements msgp.Marshaler -func (z Entry) MarshalMsg(b []byte) (o []byte, err error) { - o = msgp.Require(b, z.Msgsize()) - o = msgp.AppendArrayHeader(o, 2) - o = msgp.AppendInt64(o, z.Time) - o, err = msgp.AppendIntf(o, z.Record) - if err != nil { - return - } - return -} - -// UnmarshalMsg implements msgp.Unmarshaler -func (z *Entry) UnmarshalMsg(bts []byte) (o []byte, err error) { - { - var ssz uint32 - ssz, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - return - } - if ssz != 2 { - err = msgp.ArrayError{Wanted: 2, Got: ssz} - return - } - } - z.Time, bts, err = msgp.ReadInt64Bytes(bts) - if err != nil { - return - } - z.Record, bts, err = msgp.ReadIntfBytes(bts) - if err != nil { - return - } - o = bts - return -} - -func (z Entry) Msgsize() (s int) { - s = msgp.ArrayHeaderSize + msgp.Int64Size + msgp.GuessSize(z.Record) - return -} - -// DecodeMsg implements msgp.Decodable -func (z *Forward) DecodeMsg(dc *msgp.Reader) (err error) { - var ssz uint32 - ssz, err = dc.ReadArrayHeader() - if err != nil { - return - } - if ssz != 3 { - err = msgp.ArrayError{Wanted: 3, Got: ssz} - return - } - z.Tag, err = dc.ReadString() - if err != nil { - return - } - var xsz uint32 - xsz, err = dc.ReadArrayHeader() - if err != nil { - return - } - if cap(z.Entries) >= int(xsz) { - z.Entries = z.Entries[:xsz] - } else { - z.Entries = make([]Entry, xsz) - } - for xvk := range z.Entries { - var ssz uint32 - ssz, err = dc.ReadArrayHeader() - if err != nil { - return - } - if ssz != 2 { - err = msgp.ArrayError{Wanted: 2, Got: ssz} - return - } - z.Entries[xvk].Time, err = dc.ReadInt64() - if err != nil { - return - } - z.Entries[xvk].Record, err = dc.ReadIntf() - if err != nil { - return - } - } - z.Option, err = dc.ReadIntf() - if err != nil { - return - } - return -} - -// EncodeMsg implements msgp.Encodable -func (z *Forward) EncodeMsg(en *msgp.Writer) (err error) { - err = en.WriteArrayHeader(3) - if err != nil { - return - } - err = en.WriteString(z.Tag) - if err != nil { - return - } - err = en.WriteArrayHeader(uint32(len(z.Entries))) - if err != nil { - return - } - for xvk := range z.Entries { - err = en.WriteArrayHeader(2) - if err != nil { - return - } - err = en.WriteInt64(z.Entries[xvk].Time) - if err != nil { - return - } - err = en.WriteIntf(z.Entries[xvk].Record) - if err != nil { - return - } - } - err = en.WriteIntf(z.Option) - if err != nil { - return - } - return -} - -// MarshalMsg implements msgp.Marshaler -func (z *Forward) MarshalMsg(b []byte) (o []byte, err error) { - o = msgp.Require(b, z.Msgsize()) - o = msgp.AppendArrayHeader(o, 3) - o = msgp.AppendString(o, z.Tag) - o = msgp.AppendArrayHeader(o, uint32(len(z.Entries))) - for xvk := range z.Entries { - o = msgp.AppendArrayHeader(o, 2) - o = msgp.AppendInt64(o, z.Entries[xvk].Time) - o, err = msgp.AppendIntf(o, z.Entries[xvk].Record) - if err != nil { - return - } - } - o, err = msgp.AppendIntf(o, z.Option) - if err != nil { - return - } - return -} - -// UnmarshalMsg implements msgp.Unmarshaler -func (z *Forward) UnmarshalMsg(bts []byte) (o []byte, err error) { - { - var ssz uint32 - ssz, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - return - } - if ssz != 3 { - err = msgp.ArrayError{Wanted: 3, Got: ssz} - return - } - } - z.Tag, bts, err = msgp.ReadStringBytes(bts) - if err != nil { - return - } - var xsz uint32 - xsz, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - return - } - if cap(z.Entries) >= int(xsz) { - z.Entries = z.Entries[:xsz] - } else { - z.Entries = make([]Entry, xsz) - } - for xvk := range z.Entries { - { - var ssz uint32 - ssz, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - return - } - if ssz != 2 { - err = msgp.ArrayError{Wanted: 2, Got: ssz} - return - } - } - z.Entries[xvk].Time, bts, err = msgp.ReadInt64Bytes(bts) - if err != nil { - return - } - z.Entries[xvk].Record, bts, err = msgp.ReadIntfBytes(bts) - if err != nil { - return - } - } - z.Option, bts, err = msgp.ReadIntfBytes(bts) - if err != nil { - return - } - o = bts - return -} - -func (z *Forward) Msgsize() (s int) { - s = msgp.ArrayHeaderSize + msgp.StringPrefixSize + len(z.Tag) + msgp.ArrayHeaderSize - for xvk := range z.Entries { - s += msgp.ArrayHeaderSize + msgp.Int64Size + msgp.GuessSize(z.Entries[xvk].Record) - } - s += msgp.GuessSize(z.Option) - return -} - -// DecodeMsg implements msgp.Decodable -func (z *Message) DecodeMsg(dc *msgp.Reader) (err error) { - var ssz uint32 - ssz, err = dc.ReadArrayHeader() - if err != nil { - return - } - if ssz != 4 { - err = msgp.ArrayError{Wanted: 4, Got: ssz} - return - } - z.Tag, err = dc.ReadString() - if err != nil { - return - } - z.Time, err = dc.ReadInt64() - if err != nil { - return - } - z.Record, err = dc.ReadIntf() - if err != nil { - return - } - z.Option, err = dc.ReadIntf() - if err != nil { - return - } - return -} - -// EncodeMsg implements msgp.Encodable -func (z *Message) EncodeMsg(en *msgp.Writer) (err error) { - err = en.WriteArrayHeader(4) - if err != nil { - return - } - err = en.WriteString(z.Tag) - if err != nil { - return - } - err = en.WriteInt64(z.Time) - if err != nil { - return - } - err = en.WriteIntf(z.Record) - if err != nil { - return - } - err = en.WriteIntf(z.Option) - if err != nil { - return - } - return -} - -// MarshalMsg implements msgp.Marshaler -func (z *Message) MarshalMsg(b []byte) (o []byte, err error) { - o = msgp.Require(b, z.Msgsize()) - o = msgp.AppendArrayHeader(o, 4) - o = msgp.AppendString(o, z.Tag) - o = msgp.AppendInt64(o, z.Time) - o, err = msgp.AppendIntf(o, z.Record) - if err != nil { - return - } - o, err = msgp.AppendIntf(o, z.Option) - if err != nil { - return - } - return -} - -// UnmarshalMsg implements msgp.Unmarshaler -func (z *Message) UnmarshalMsg(bts []byte) (o []byte, err error) { - { - var ssz uint32 - ssz, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - return - } - if ssz != 4 { - err = msgp.ArrayError{Wanted: 4, Got: ssz} - return - } - } - z.Tag, bts, err = msgp.ReadStringBytes(bts) - if err != nil { - return - } - z.Time, bts, err = msgp.ReadInt64Bytes(bts) - if err != nil { - return - } - z.Record, bts, err = msgp.ReadIntfBytes(bts) - if err != nil { - return - } - z.Option, bts, err = msgp.ReadIntfBytes(bts) - if err != nil { - return - } - o = bts - return -} - -func (z *Message) Msgsize() (s int) { - s = msgp.ArrayHeaderSize + msgp.StringPrefixSize + len(z.Tag) + msgp.Int64Size + msgp.GuessSize(z.Record) + msgp.GuessSize(z.Option) - return -} diff --git a/vendor/github.com/fluent/fluent-logger-golang/fluent/proto_gen_test.go b/vendor/github.com/fluent/fluent-logger-golang/fluent/proto_gen_test.go deleted file mode 100644 index 5d479ea1..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/fluent/proto_gen_test.go +++ /dev/null @@ -1,350 +0,0 @@ -package fluent - -// NOTE: THIS FILE WAS PRODUCED BY THE -// MSGP CODE GENERATION TOOL (github.com/tinylib/msgp) -// DO NOT EDIT - -import ( - "bytes" - "github.com/tinylib/msgp/msgp" - "testing" -) - -func TestEntryMarshalUnmarshal(t *testing.T) { - v := Entry{} - bts, err := v.MarshalMsg(nil) - if err != nil { - t.Fatal(err) - } - left, err := v.UnmarshalMsg(bts) - if err != nil { - t.Fatal(err) - } - if len(left) > 0 { - t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) - } - - left, err = msgp.Skip(bts) - if err != nil { - t.Fatal(err) - } - if len(left) > 0 { - t.Errorf("%d bytes left over after Skip(): %q", len(left), left) - } -} - -func BenchmarkEntryMarshalMsg(b *testing.B) { - v := Entry{} - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - v.MarshalMsg(nil) - } -} - -func BenchmarkEntryAppendMsg(b *testing.B) { - v := Entry{} - bts := make([]byte, 0, v.Msgsize()) - bts, _ = v.MarshalMsg(bts[0:0]) - b.SetBytes(int64(len(bts))) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - bts, _ = v.MarshalMsg(bts[0:0]) - } -} - -func BenchmarkEntryUnmarshal(b *testing.B) { - v := Entry{} - bts, _ := v.MarshalMsg(nil) - b.ReportAllocs() - b.SetBytes(int64(len(bts))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := v.UnmarshalMsg(bts) - if err != nil { - b.Fatal(err) - } - } -} - -func TestEntryEncodeDecode(t *testing.T) { - v := Entry{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - - m := v.Msgsize() - if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) - } - - vn := Entry{} - err := msgp.Decode(&buf, &vn) - if err != nil { - t.Error(err) - } - - buf.Reset() - msgp.Encode(&buf, &v) - err = msgp.NewReader(&buf).Skip() - if err != nil { - t.Error(err) - } -} - -func BenchmarkEntryEncode(b *testing.B) { - v := Entry{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - b.SetBytes(int64(buf.Len())) - en := msgp.NewWriter(msgp.Nowhere) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - v.EncodeMsg(en) - } - en.Flush() -} - -func BenchmarkEntryDecode(b *testing.B) { - v := Entry{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - b.SetBytes(int64(buf.Len())) - rd := msgp.NewEndlessReader(buf.Bytes(), b) - dc := msgp.NewReader(rd) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - err := v.DecodeMsg(dc) - if err != nil { - b.Fatal(err) - } - } -} - -func TestForwardMarshalUnmarshal(t *testing.T) { - v := Forward{} - bts, err := v.MarshalMsg(nil) - if err != nil { - t.Fatal(err) - } - left, err := v.UnmarshalMsg(bts) - if err != nil { - t.Fatal(err) - } - if len(left) > 0 { - t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) - } - - left, err = msgp.Skip(bts) - if err != nil { - t.Fatal(err) - } - if len(left) > 0 { - t.Errorf("%d bytes left over after Skip(): %q", len(left), left) - } -} - -func BenchmarkForwardMarshalMsg(b *testing.B) { - v := Forward{} - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - v.MarshalMsg(nil) - } -} - -func BenchmarkForwardAppendMsg(b *testing.B) { - v := Forward{} - bts := make([]byte, 0, v.Msgsize()) - bts, _ = v.MarshalMsg(bts[0:0]) - b.SetBytes(int64(len(bts))) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - bts, _ = v.MarshalMsg(bts[0:0]) - } -} - -func BenchmarkForwardUnmarshal(b *testing.B) { - v := Forward{} - bts, _ := v.MarshalMsg(nil) - b.ReportAllocs() - b.SetBytes(int64(len(bts))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := v.UnmarshalMsg(bts) - if err != nil { - b.Fatal(err) - } - } -} - -func TestForwardEncodeDecode(t *testing.T) { - v := Forward{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - - m := v.Msgsize() - if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) - } - - vn := Forward{} - err := msgp.Decode(&buf, &vn) - if err != nil { - t.Error(err) - } - - buf.Reset() - msgp.Encode(&buf, &v) - err = msgp.NewReader(&buf).Skip() - if err != nil { - t.Error(err) - } -} - -func BenchmarkForwardEncode(b *testing.B) { - v := Forward{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - b.SetBytes(int64(buf.Len())) - en := msgp.NewWriter(msgp.Nowhere) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - v.EncodeMsg(en) - } - en.Flush() -} - -func BenchmarkForwardDecode(b *testing.B) { - v := Forward{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - b.SetBytes(int64(buf.Len())) - rd := msgp.NewEndlessReader(buf.Bytes(), b) - dc := msgp.NewReader(rd) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - err := v.DecodeMsg(dc) - if err != nil { - b.Fatal(err) - } - } -} - -func TestMessageMarshalUnmarshal(t *testing.T) { - v := Message{} - bts, err := v.MarshalMsg(nil) - if err != nil { - t.Fatal(err) - } - left, err := v.UnmarshalMsg(bts) - if err != nil { - t.Fatal(err) - } - if len(left) > 0 { - t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) - } - - left, err = msgp.Skip(bts) - if err != nil { - t.Fatal(err) - } - if len(left) > 0 { - t.Errorf("%d bytes left over after Skip(): %q", len(left), left) - } -} - -func BenchmarkMessageMarshalMsg(b *testing.B) { - v := Message{} - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - v.MarshalMsg(nil) - } -} - -func BenchmarkMessageAppendMsg(b *testing.B) { - v := Message{} - bts := make([]byte, 0, v.Msgsize()) - bts, _ = v.MarshalMsg(bts[0:0]) - b.SetBytes(int64(len(bts))) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - bts, _ = v.MarshalMsg(bts[0:0]) - } -} - -func BenchmarkMessageUnmarshal(b *testing.B) { - v := Message{} - bts, _ := v.MarshalMsg(nil) - b.ReportAllocs() - b.SetBytes(int64(len(bts))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := v.UnmarshalMsg(bts) - if err != nil { - b.Fatal(err) - } - } -} - -func TestMessageEncodeDecode(t *testing.T) { - v := Message{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - - m := v.Msgsize() - if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) - } - - vn := Message{} - err := msgp.Decode(&buf, &vn) - if err != nil { - t.Error(err) - } - - buf.Reset() - msgp.Encode(&buf, &v) - err = msgp.NewReader(&buf).Skip() - if err != nil { - t.Error(err) - } -} - -func BenchmarkMessageEncode(b *testing.B) { - v := Message{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - b.SetBytes(int64(buf.Len())) - en := msgp.NewWriter(msgp.Nowhere) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - v.EncodeMsg(en) - } - en.Flush() -} - -func BenchmarkMessageDecode(b *testing.B) { - v := Message{} - var buf bytes.Buffer - msgp.Encode(&buf, &v) - b.SetBytes(int64(buf.Len())) - rd := msgp.NewEndlessReader(buf.Bytes(), b) - dc := msgp.NewReader(rd) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - err := v.DecodeMsg(dc) - if err != nil { - b.Fatal(err) - } - } -} diff --git a/vendor/github.com/fluent/fluent-logger-golang/fluent/version.go b/vendor/github.com/fluent/fluent-logger-golang/fluent/version.go deleted file mode 100644 index 8904726d..00000000 --- a/vendor/github.com/fluent/fluent-logger-golang/fluent/version.go +++ /dev/null @@ -1,3 +0,0 @@ -package fluent - -const Version = "1.2.1" diff --git a/vendor/github.com/fsouza/ctxlogger/.gitignore b/vendor/github.com/fsouza/ctxlogger/.gitignore deleted file mode 100644 index c57100a5..00000000 --- a/vendor/github.com/fsouza/ctxlogger/.gitignore +++ /dev/null @@ -1 +0,0 @@ -coverage.txt diff --git a/vendor/github.com/fsouza/ctxlogger/.travis.yml b/vendor/github.com/fsouza/ctxlogger/.travis.yml deleted file mode 100644 index 1cc03d02..00000000 --- a/vendor/github.com/fsouza/ctxlogger/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go -sudo: false -go: - - 1.8.x - - 1.9 - - tip -install: - - make testdeps -script: - - make lint coverage -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/fsouza/ctxlogger/LICENSE b/vendor/github.com/fsouza/ctxlogger/LICENSE deleted file mode 100644 index 40a80cd6..00000000 --- a/vendor/github.com/fsouza/ctxlogger/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2016-2017, Francisco Souza -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/fsouza/ctxlogger/Makefile b/vendor/github.com/fsouza/ctxlogger/Makefile deleted file mode 100644 index b7343c9b..00000000 --- a/vendor/github.com/fsouza/ctxlogger/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2016 Francisco Souza. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -all: test - -test: lint gotest - -coverage: testdeps - go test -race -coverprofile coverage.txt -covermode=atomic - -lint: testdeps - go get github.com/alecthomas/gometalinter - gometalinter --install --vendored-linters - go install - go list -f '{{.TestImports}}' | sed -e 's/\[\(.*\)\]/\1/' | tr ' ' '\n' | grep '^.*\..*/.*$$' | xargs go install - gometalinter -j 4 --enable-all --line-length=120 --deadline=10m --tests - -gotest: testdeps - go test -race - -testdeps: - go get -d -t diff --git a/vendor/github.com/fsouza/ctxlogger/README.md b/vendor/github.com/fsouza/ctxlogger/README.md deleted file mode 100644 index b6eb0d6a..00000000 --- a/vendor/github.com/fsouza/ctxlogger/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# ctxlogger - -[![Build Status](https://travis-ci.org/fsouza/ctxlogger.svg?branch=master)](https://travis-ci.org/fsouza/ctxlogger) -[![codecov](https://codecov.io/gh/fsouza/ctxlogger/branch/master/graph/badge.svg)](https://codecov.io/gh/fsouza/ctxlogger) - -[Gizmo](https://github.com/NYTimes/gizmo) middleware that adds a logger to the -context, including any path variables as logrus fields. - -The folder examples include a example server that uses the middleware. diff --git a/vendor/github.com/fsouza/ctxlogger/doc.go b/vendor/github.com/fsouza/ctxlogger/doc.go deleted file mode 100644 index aef8347a..00000000 --- a/vendor/github.com/fsouza/ctxlogger/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2016 Francisco Souza. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ctxlogger provides a Gizmo middleware that automatically adds a -// given logger to the request context. It includes any path variable as fields -// in the logger. -package ctxlogger diff --git a/vendor/github.com/fsouza/ctxlogger/middleware.go b/vendor/github.com/fsouza/ctxlogger/middleware.go deleted file mode 100644 index 167c61aa..00000000 --- a/vendor/github.com/fsouza/ctxlogger/middleware.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2016 Francisco Souza. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ctxlogger - -import ( - "context" - "net/http" - - "github.com/NYTimes/gizmo/web" - "github.com/sirupsen/logrus" -) - -// ContextKey is the key used by the middleware to set the logger. -var ContextKey = &struct{ key string }{key: "ctxlogger"} - -// ContextLogger takes the logger and returns the middleware that will always -// add the logger to the request context. -// -// It also expands the logger with any path variable on the given request -// (using path variables as defined with Gizmo). -// -// Last, but not least, it also tracks request ids using the header -// X-Request-Id. -func ContextLogger(baseLogger *logrus.Logger) func(h http.Handler) http.Handler { - return func(h http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - logger := baseLogger - vars := web.Vars(r) - if reqID := r.Header.Get("X-Request-Id"); reqID != "" { - if vars == nil { - vars = make(map[string]string) - } - vars["requestId"] = reqID - } - if len(vars) > 0 { - logger = varsLogger(vars, baseLogger) - } - h.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), ContextKey, logger))) - }) - } -} - -func varsLogger(vars map[string]string, logger *logrus.Logger) *logrus.Logger { - newLogger := logrus.Logger{ - Out: logger.Out, - Formatter: logger.Formatter, - Hooks: make(logrus.LevelHooks), - Level: logger.Level, - } - for level, hooks := range logger.Hooks { - newLogger.Hooks[level] = append([]logrus.Hook(nil), hooks...) - } - newLogger.Hooks.Add(&varsLogHook{vars}) - return &newLogger -} - -type varsLogHook struct { - vars map[string]string -} - -func (h *varsLogHook) Levels() []logrus.Level { - return logrus.AllLevels -} - -func (h *varsLogHook) Fire(e *logrus.Entry) error { - fields := make(logrus.Fields) - for k, v := range h.vars { - if _, ok := e.Data[k]; !ok { - fields[k] = v - } - } - newEntry := e.WithFields(fields) - newEntry.Time = e.Time - newEntry.Message = e.Message - newEntry.Level = e.Level - newEntry.Buffer = e.Buffer - *e = *newEntry - return nil -} diff --git a/vendor/github.com/fsouza/ctxlogger/middleware_test.go b/vendor/github.com/fsouza/ctxlogger/middleware_test.go deleted file mode 100644 index 56e7b407..00000000 --- a/vendor/github.com/fsouza/ctxlogger/middleware_test.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2016 Francisco Souza. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ctxlogger - -import ( - "bytes" - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "reflect" - "strings" - "testing" - - "github.com/NYTimes/gizmo/web" - "github.com/sirupsen/logrus" -) - -func TestContextLoggerMiddleware(t *testing.T) { - var tests = []struct { - testCase string - header http.Header - vars map[string]string - wantLogLine map[string]string - }{ - { - "request with vars", - http.Header{}, - map[string]string{"jobId": "some-job", "limit": "3"}, - map[string]string{ - "level": "info", - "msg": "received a nice request!", - "jobId": "some-job", - "limit": "3", - }, - }, - { - "request with vars and id", - http.Header{"X-Request-Id": []string{"request-123"}}, - map[string]string{"jobId": "some-job", "limit": "3"}, - map[string]string{ - "level": "info", - "msg": "received a nice request!", - "jobId": "some-job", - "limit": "3", - "requestId": "request-123", - }, - }, - { - "request with vars and id - override", - http.Header{"X-Request-Id": []string{"request-123"}}, - map[string]string{"jobId": "some-job", "limit": "3", "requestId": "request-1234"}, - map[string]string{ - "level": "info", - "msg": "received a nice request!", - "jobId": "some-job", - "limit": "3", - "requestId": "request-123", - }, - }, - { - "request with no vars", - http.Header{}, - nil, - map[string]string{ - "level": "info", - "msg": "received a nice request!", - }, - }, - { - "request with no vars and id", - http.Header{"X-Request-Id": []string{"request-123"}}, - nil, - map[string]string{ - "level": "info", - "msg": "received a nice request!", - "requestId": "request-123", - }, - }, - } - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - logger := r.Context().Value(ContextKey).(*logrus.Logger) - logger.Info("received a nice request!") - w.WriteHeader(http.StatusOK) - }) - for _, test := range tests { - t.Run(test.testCase, func(t *testing.T) { - req, _ := http.NewRequest(http.MethodGet, "/something", nil) - req.Header = test.header - web.SetRouteVars(req, test.vars) - rec := httptest.NewRecorder() - var b bytes.Buffer - logger := logrus.New() - logger.Out = &b - logger.Level = logrus.DebugLevel - logger.Formatter = &logrus.JSONFormatter{} - middleware := ContextLogger(logger) - h := middleware(handler) - h.ServeHTTP(rec, req) - if rec.Code != http.StatusOK { - t.Errorf("wrong status code\ngot %d\nwant %d", rec.Code, http.StatusOK) - } - var logLine map[string]string - err := json.Unmarshal(bytes.TrimSpace(b.Bytes()), &logLine) - if err != nil { - t.Fatal(err) - } - test.wantLogLine["time"] = logLine["time"] - if !reflect.DeepEqual(logLine, test.wantLogLine) { - t.Errorf("wrong log line returned\ngot %#v\nwant %#v", logLine, test.wantLogLine) - } - }) - } -} - -func TestVarsLogger(t *testing.T) { - var b bytes.Buffer - logger := logrus.New() - logger.Out = &b - logger.Level = logrus.DebugLevel - logger.Formatter = &logrus.JSONFormatter{} - vl := varsLogger(map[string]string{"jobId": "some-job", "whatever": "yes!"}, logger) - if vl == nil { - t.Fatal("unexpected logger") - } - vl.Error("something went wrong") - vl.Warning("something will go wrong") - vl.Debug("what a lovely day") - vl.WithField("whatever", "no!").Error("something went wrong again") - lines := strings.Split(strings.TrimSpace(b.String()), "\n") - if len(lines) != 4 { - t.Fatalf("wrong number of line. Got %d. Want %d", len(lines), 4) - } - rawData := fmt.Sprintf("[%s]", strings.Join(lines, ",")) - var logMsgs []map[string]string - err := json.Unmarshal([]byte(rawData), &logMsgs) - if err != nil { - t.Fatal(err) - } - for _, msg := range logMsgs { - if msg["time"] == "" { - t.Errorf("unexpected empty time in log entry: %#v", msg) - } - delete(msg, "time") - } - expectedMsgs := []map[string]string{ - {"level": "error", "jobId": "some-job", "msg": "something went wrong", "whatever": "yes!"}, - {"level": "warning", "jobId": "some-job", "msg": "something will go wrong", "whatever": "yes!"}, - {"level": "debug", "jobId": "some-job", "msg": "what a lovely day", "whatever": "yes!"}, - {"level": "error", "jobId": "some-job", "msg": "something went wrong again", "whatever": "no!"}, - } - if !reflect.DeepEqual(logMsgs, expectedMsgs) { - t.Errorf("wrong messages returned\nwant %#v\ngot %#v", expectedMsgs, logMsgs) - } -} diff --git a/vendor/github.com/fsouza/ctxlogger/race_test.go b/vendor/github.com/fsouza/ctxlogger/race_test.go deleted file mode 100644 index 965ee4d4..00000000 --- a/vendor/github.com/fsouza/ctxlogger/race_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 Francisco Souza. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ctxlogger - -import ( - "strings" - "sync" - "testing" - - "github.com/sirupsen/logrus" - "github.com/sirupsen/logrus/hooks/test" - "github.com/tsuru/tsuru/safe" -) - -type safeFakeHook struct { - test.Hook - mtx sync.Mutex -} - -func (h *safeFakeHook) Fire(e *logrus.Entry) error { - h.mtx.Lock() - defer h.mtx.Unlock() - return h.Hook.Fire(e) -} - -func TestVarsLoggerIsSafe(t *testing.T) { - var fakeHook safeFakeHook - const N = 32 - var b safe.Buffer - logger := logrus.New() - logger.Out = &b - logger.Level = logrus.DebugLevel - logger.Formatter = &logrus.JSONFormatter{} - logger.Hooks.Add(&fakeHook) - var wg sync.WaitGroup - for i := 0; i < N; i++ { - wg.Add(1) - go func(i int) { - innerLogger := varsLogger(map[string]string{"name": "gopher"}, logger) - innerLogger.WithField("some", "thing").Info("be advised") - wg.Done() - }(i) - } - wg.Wait() - logLines := strings.Split(strings.TrimSpace(b.String()), "\n") - if len(logLines) != N { - t.Errorf("wrong log lines returned, wanted %d log lines, got %d:\n%s", N, len(logLines), b.String()) - } - if len(fakeHook.Entries) != N { - t.Errorf("wrong number of entries in the hook. want %d, got %d", N, len(fakeHook.Entries)) - } -} diff --git a/vendor/github.com/go-ini/ini/.gitignore b/vendor/github.com/go-ini/ini/.gitignore deleted file mode 100644 index 12411127..00000000 --- a/vendor/github.com/go-ini/ini/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -testdata/conf_out.ini -ini.sublime-project -ini.sublime-workspace -testdata/conf_reflect.ini -.idea -/.vscode diff --git a/vendor/github.com/go-ini/ini/.travis.yml b/vendor/github.com/go-ini/ini/.travis.yml deleted file mode 100644 index 9787d4db..00000000 --- a/vendor/github.com/go-ini/ini/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: go -go: - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - -script: - - go get golang.org/x/tools/cmd/cover - - go get github.com/smartystreets/goconvey - - go test -v -cover -race diff --git a/vendor/github.com/go-ini/ini/LICENSE b/vendor/github.com/go-ini/ini/LICENSE deleted file mode 100644 index d361bbcd..00000000 --- a/vendor/github.com/go-ini/ini/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright 2014 Unknwon - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/go-ini/ini/Makefile b/vendor/github.com/go-ini/ini/Makefile deleted file mode 100644 index ac034e52..00000000 --- a/vendor/github.com/go-ini/ini/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -.PHONY: build test bench vet - -build: vet bench - -test: - go test -v -cover -race - -bench: - go test -v -cover -race -test.bench=. -test.benchmem - -vet: - go vet diff --git a/vendor/github.com/go-ini/ini/README.md b/vendor/github.com/go-ini/ini/README.md deleted file mode 100644 index f4ff27cd..00000000 --- a/vendor/github.com/go-ini/ini/README.md +++ /dev/null @@ -1,763 +0,0 @@ -INI [![Build Status](https://travis-ci.org/go-ini/ini.svg?branch=master)](https://travis-ci.org/go-ini/ini) [![Sourcegraph](https://sourcegraph.com/github.com/go-ini/ini/-/badge.svg)](https://sourcegraph.com/github.com/go-ini/ini?badge) -=== - -![](https://avatars0.githubusercontent.com/u/10216035?v=3&s=200) - -Package ini provides INI file read and write functionality in Go. - -[简体中文](README_ZH.md) - -## Feature - -- Load multiple data sources(`[]byte`, file and `io.ReadCloser`) with overwrites. -- Read with recursion values. -- Read with parent-child sections. -- Read with auto-increment key names. -- Read with multiple-line values. -- Read with tons of helper methods. -- Read and convert values to Go types. -- Read and **WRITE** comments of sections and keys. -- Manipulate sections, keys and comments with ease. -- Keep sections and keys in order as you parse and save. - -## Installation - -To use a tagged revision: - - go get gopkg.in/ini.v1 - -To use with latest changes: - - go get github.com/go-ini/ini - -Please add `-u` flag to update in the future. - -### Testing - -If you want to test on your machine, please apply `-t` flag: - - go get -t gopkg.in/ini.v1 - -Please add `-u` flag to update in the future. - -## Getting Started - -### Loading from data sources - -A **Data Source** is either raw data in type `[]byte`, a file name with type `string` or `io.ReadCloser`. You can load **as many data sources as you want**. Passing other types will simply return an error. - -```go -cfg, err := ini.Load([]byte("raw data"), "filename", ioutil.NopCloser(bytes.NewReader([]byte("some other data")))) -``` - -Or start with an empty object: - -```go -cfg := ini.Empty() -``` - -When you cannot decide how many data sources to load at the beginning, you will still be able to **Append()** them later. - -```go -err := cfg.Append("other file", []byte("other raw data")) -``` - -If you have a list of files with possibilities that some of them may not available at the time, and you don't know exactly which ones, you can use `LooseLoad` to ignore nonexistent files without returning error. - -```go -cfg, err := ini.LooseLoad("filename", "filename_404") -``` - -The cool thing is, whenever the file is available to load while you're calling `Reload` method, it will be counted as usual. - -#### Ignore cases of key name - -When you do not care about cases of section and key names, you can use `InsensitiveLoad` to force all names to be lowercased while parsing. - -```go -cfg, err := ini.InsensitiveLoad("filename") -//... - -// sec1 and sec2 are the exactly same section object -sec1, err := cfg.GetSection("Section") -sec2, err := cfg.GetSection("SecTIOn") - -// key1 and key2 are the exactly same key object -key1, err := sec1.GetKey("Key") -key2, err := sec2.GetKey("KeY") -``` - -#### MySQL-like boolean key - -MySQL's configuration allows a key without value as follows: - -```ini -[mysqld] -... -skip-host-cache -skip-name-resolve -``` - -By default, this is considered as missing value. But if you know you're going to deal with those cases, you can assign advanced load options: - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{AllowBooleanKeys: true}, "my.cnf")) -``` - -The value of those keys are always `true`, and when you save to a file, it will keep in the same foramt as you read. - -To generate such keys in your program, you could use `NewBooleanKey`: - -```go -key, err := sec.NewBooleanKey("skip-host-cache") -``` - -#### Comment - -Take care that following format will be treated as comment: - -1. Line begins with `#` or `;` -2. Words after `#` or `;` -3. Words after section name (i.e words after `[some section name]`) - -If you want to save a value with `#` or `;`, please quote them with ``` ` ``` or ``` """ ```. - -Alternatively, you can use following `LoadOptions` to completely ignore inline comments: - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: true}, "app.ini")) -``` - -### Working with sections - -To get a section, you would need to: - -```go -section, err := cfg.GetSection("section name") -``` - -For a shortcut for default section, just give an empty string as name: - -```go -section, err := cfg.GetSection("") -``` - -When you're pretty sure the section exists, following code could make your life easier: - -```go -section := cfg.Section("section name") -``` - -What happens when the section somehow does not exist? Don't panic, it automatically creates and returns a new section to you. - -To create a new section: - -```go -err := cfg.NewSection("new section") -``` - -To get a list of sections or section names: - -```go -sections := cfg.Sections() -names := cfg.SectionStrings() -``` - -### Working with keys - -To get a key under a section: - -```go -key, err := cfg.Section("").GetKey("key name") -``` - -Same rule applies to key operations: - -```go -key := cfg.Section("").Key("key name") -``` - -To check if a key exists: - -```go -yes := cfg.Section("").HasKey("key name") -``` - -To create a new key: - -```go -err := cfg.Section("").NewKey("name", "value") -``` - -To get a list of keys or key names: - -```go -keys := cfg.Section("").Keys() -names := cfg.Section("").KeyStrings() -``` - -To get a clone hash of keys and corresponding values: - -```go -hash := cfg.Section("").KeysHash() -``` - -### Working with values - -To get a string value: - -```go -val := cfg.Section("").Key("key name").String() -``` - -To validate key value on the fly: - -```go -val := cfg.Section("").Key("key name").Validate(func(in string) string { - if len(in) == 0 { - return "default" - } - return in -}) -``` - -If you do not want any auto-transformation (such as recursive read) for the values, you can get raw value directly (this way you get much better performance): - -```go -val := cfg.Section("").Key("key name").Value() -``` - -To check if raw value exists: - -```go -yes := cfg.Section("").HasValue("test value") -``` - -To get value with types: - -```go -// For boolean values: -// true when value is: 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On -// false when value is: 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off -v, err = cfg.Section("").Key("BOOL").Bool() -v, err = cfg.Section("").Key("FLOAT64").Float64() -v, err = cfg.Section("").Key("INT").Int() -v, err = cfg.Section("").Key("INT64").Int64() -v, err = cfg.Section("").Key("UINT").Uint() -v, err = cfg.Section("").Key("UINT64").Uint64() -v, err = cfg.Section("").Key("TIME").TimeFormat(time.RFC3339) -v, err = cfg.Section("").Key("TIME").Time() // RFC3339 - -v = cfg.Section("").Key("BOOL").MustBool() -v = cfg.Section("").Key("FLOAT64").MustFloat64() -v = cfg.Section("").Key("INT").MustInt() -v = cfg.Section("").Key("INT64").MustInt64() -v = cfg.Section("").Key("UINT").MustUint() -v = cfg.Section("").Key("UINT64").MustUint64() -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339) -v = cfg.Section("").Key("TIME").MustTime() // RFC3339 - -// Methods start with Must also accept one argument for default value -// when key not found or fail to parse value to given type. -// Except method MustString, which you have to pass a default value. - -v = cfg.Section("").Key("String").MustString("default") -v = cfg.Section("").Key("BOOL").MustBool(true) -v = cfg.Section("").Key("FLOAT64").MustFloat64(1.25) -v = cfg.Section("").Key("INT").MustInt(10) -v = cfg.Section("").Key("INT64").MustInt64(99) -v = cfg.Section("").Key("UINT").MustUint(3) -v = cfg.Section("").Key("UINT64").MustUint64(6) -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339, time.Now()) -v = cfg.Section("").Key("TIME").MustTime(time.Now()) // RFC3339 -``` - -What if my value is three-line long? - -```ini -[advance] -ADDRESS = """404 road, -NotFound, State, 5000 -Earth""" -``` - -Not a problem! - -```go -cfg.Section("advance").Key("ADDRESS").String() - -/* --- start --- -404 road, -NotFound, State, 5000 -Earth ------- end --- */ -``` - -That's cool, how about continuation lines? - -```ini -[advance] -two_lines = how about \ - continuation lines? -lots_of_lines = 1 \ - 2 \ - 3 \ - 4 -``` - -Piece of cake! - -```go -cfg.Section("advance").Key("two_lines").String() // how about continuation lines? -cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4 -``` - -Well, I hate continuation lines, how do I disable that? - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{ - IgnoreContinuation: true, -}, "filename") -``` - -Holy crap! - -Note that single quotes around values will be stripped: - -```ini -foo = "some value" // foo: some value -bar = 'some value' // bar: some value -``` - -Sometimes you downloaded file from [Crowdin](https://crowdin.com/) has values like the following (value is surrounded by double quotes and quotes in the value are escaped): - -```ini -create_repo="created repository %s" -``` - -How do you transform this to regular format automatically? - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{UnescapeValueDoubleQuotes: true}, "en-US.ini")) -cfg.Section("").Key("create_repo").String() -// You got: created repository %s -``` - -That's all? Hmm, no. - -#### Helper methods of working with values - -To get value with given candidates: - -```go -v = cfg.Section("").Key("STRING").In("default", []string{"str", "arr", "types"}) -v = cfg.Section("").Key("FLOAT64").InFloat64(1.1, []float64{1.25, 2.5, 3.75}) -v = cfg.Section("").Key("INT").InInt(5, []int{10, 20, 30}) -v = cfg.Section("").Key("INT64").InInt64(10, []int64{10, 20, 30}) -v = cfg.Section("").Key("UINT").InUint(4, []int{3, 6, 9}) -v = cfg.Section("").Key("UINT64").InUint64(8, []int64{3, 6, 9}) -v = cfg.Section("").Key("TIME").InTimeFormat(time.RFC3339, time.Now(), []time.Time{time1, time2, time3}) -v = cfg.Section("").Key("TIME").InTime(time.Now(), []time.Time{time1, time2, time3}) // RFC3339 -``` - -Default value will be presented if value of key is not in candidates you given, and default value does not need be one of candidates. - -To validate value in a given range: - -```go -vals = cfg.Section("").Key("FLOAT64").RangeFloat64(0.0, 1.1, 2.2) -vals = cfg.Section("").Key("INT").RangeInt(0, 10, 20) -vals = cfg.Section("").Key("INT64").RangeInt64(0, 10, 20) -vals = cfg.Section("").Key("UINT").RangeUint(0, 3, 9) -vals = cfg.Section("").Key("UINT64").RangeUint64(0, 3, 9) -vals = cfg.Section("").Key("TIME").RangeTimeFormat(time.RFC3339, time.Now(), minTime, maxTime) -vals = cfg.Section("").Key("TIME").RangeTime(time.Now(), minTime, maxTime) // RFC3339 -``` - -##### Auto-split values into a slice - -To use zero value of type for invalid inputs: - -```go -// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4] -// Input: how, 2.2, are, you -> [0.0 2.2 0.0 0.0] -vals = cfg.Section("").Key("STRINGS").Strings(",") -vals = cfg.Section("").Key("FLOAT64S").Float64s(",") -vals = cfg.Section("").Key("INTS").Ints(",") -vals = cfg.Section("").Key("INT64S").Int64s(",") -vals = cfg.Section("").Key("UINTS").Uints(",") -vals = cfg.Section("").Key("UINT64S").Uint64s(",") -vals = cfg.Section("").Key("TIMES").Times(",") -``` - -To exclude invalid values out of result slice: - -```go -// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4] -// Input: how, 2.2, are, you -> [2.2] -vals = cfg.Section("").Key("FLOAT64S").ValidFloat64s(",") -vals = cfg.Section("").Key("INTS").ValidInts(",") -vals = cfg.Section("").Key("INT64S").ValidInt64s(",") -vals = cfg.Section("").Key("UINTS").ValidUints(",") -vals = cfg.Section("").Key("UINT64S").ValidUint64s(",") -vals = cfg.Section("").Key("TIMES").ValidTimes(",") -``` - -Or to return nothing but error when have invalid inputs: - -```go -// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4] -// Input: how, 2.2, are, you -> error -vals = cfg.Section("").Key("FLOAT64S").StrictFloat64s(",") -vals = cfg.Section("").Key("INTS").StrictInts(",") -vals = cfg.Section("").Key("INT64S").StrictInt64s(",") -vals = cfg.Section("").Key("UINTS").StrictUints(",") -vals = cfg.Section("").Key("UINT64S").StrictUint64s(",") -vals = cfg.Section("").Key("TIMES").StrictTimes(",") -``` - -### Save your configuration - -Finally, it's time to save your configuration to somewhere. - -A typical way to save configuration is writing it to a file: - -```go -// ... -err = cfg.SaveTo("my.ini") -err = cfg.SaveToIndent("my.ini", "\t") -``` - -Another way to save is writing to a `io.Writer` interface: - -```go -// ... -cfg.WriteTo(writer) -cfg.WriteToIndent(writer, "\t") -``` - -By default, spaces are used to align "=" sign between key and values, to disable that: - -```go -ini.PrettyFormat = false -``` - -## Advanced Usage - -### Recursive Values - -For all value of keys, there is a special syntax `%()s`, where `` is the key name in same section or default section, and `%()s` will be replaced by corresponding value(empty string if key not found). You can use this syntax at most 99 level of recursions. - -```ini -NAME = ini - -[author] -NAME = Unknwon -GITHUB = https://github.com/%(NAME)s - -[package] -FULL_NAME = github.com/go-ini/%(NAME)s -``` - -```go -cfg.Section("author").Key("GITHUB").String() // https://github.com/Unknwon -cfg.Section("package").Key("FULL_NAME").String() // github.com/go-ini/ini -``` - -### Parent-child Sections - -You can use `.` in section name to indicate parent-child relationship between two or more sections. If the key not found in the child section, library will try again on its parent section until there is no parent section. - -```ini -NAME = ini -VERSION = v1 -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -[package] -CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] -``` - -```go -cfg.Section("package.sub").Key("CLONE_URL").String() // https://gopkg.in/ini.v1 -``` - -#### Retrieve parent keys available to a child section - -```go -cfg.Section("package.sub").ParentKeys() // ["CLONE_URL"] -``` - -### Unparseable Sections - -Sometimes, you have sections that do not contain key-value pairs but raw content, to handle such case, you can use `LoadOptions.UnparsableSections`: - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{UnparseableSections: []string{"COMMENTS"}}, `[COMMENTS] -<1> This slide has the fuel listed in the wrong units `)) - -body := cfg.Section("COMMENTS").Body() - -/* --- start --- -<1> This slide has the fuel listed in the wrong units ------- end --- */ -``` - -### Auto-increment Key Names - -If key name is `-` in data source, then it would be seen as special syntax for auto-increment key name start from 1, and every section is independent on counter. - -```ini -[features] --: Support read/write comments of keys and sections --: Support auto-increment of key names --: Support load multiple files to overwrite key values -``` - -```go -cfg.Section("features").KeyStrings() // []{"#1", "#2", "#3"} -``` - -### Map To Struct - -Want more objective way to play with INI? Cool. - -```ini -Name = Unknwon -age = 21 -Male = true -Born = 1993-01-01T20:17:05Z - -[Note] -Content = Hi is a good man! -Cities = HangZhou, Boston -``` - -```go -type Note struct { - Content string - Cities []string -} - -type Person struct { - Name string - Age int `ini:"age"` - Male bool - Born time.Time - Note - Created time.Time `ini:"-"` -} - -func main() { - cfg, err := ini.Load("path/to/ini") - // ... - p := new(Person) - err = cfg.MapTo(p) - // ... - - // Things can be simpler. - err = ini.MapTo(p, "path/to/ini") - // ... - - // Just map a section? Fine. - n := new(Note) - err = cfg.Section("Note").MapTo(n) - // ... -} -``` - -Can I have default value for field? Absolutely. - -Assign it before you map to struct. It will keep the value as it is if the key is not presented or got wrong type. - -```go -// ... -p := &Person{ - Name: "Joe", -} -// ... -``` - -It's really cool, but what's the point if you can't give me my file back from struct? - -### Reflect From Struct - -Why not? - -```go -type Embeded struct { - Dates []time.Time `delim:"|" comment:"Time data"` - Places []string `ini:"places,omitempty"` - None []int `ini:",omitempty"` -} - -type Author struct { - Name string `ini:"NAME"` - Male bool - Age int `comment:"Author's age"` - GPA float64 - NeverMind string `ini:"-"` - *Embeded `comment:"Embeded section"` -} - -func main() { - a := &Author{"Unknwon", true, 21, 2.8, "", - &Embeded{ - []time.Time{time.Now(), time.Now()}, - []string{"HangZhou", "Boston"}, - []int{}, - }} - cfg := ini.Empty() - err = ini.ReflectFrom(cfg, a) - // ... -} -``` - -So, what do I get? - -```ini -NAME = Unknwon -Male = true -; Author's age -Age = 21 -GPA = 2.8 - -; Embeded section -[Embeded] -; Time data -Dates = 2015-08-07T22:14:22+08:00|2015-08-07T22:14:22+08:00 -places = HangZhou,Boston -``` - -#### Name Mapper - -To save your time and make your code cleaner, this library supports [`NameMapper`](https://gowalker.org/gopkg.in/ini.v1#NameMapper) between struct field and actual section and key name. - -There are 2 built-in name mappers: - -- `AllCapsUnderscore`: it converts to format `ALL_CAPS_UNDERSCORE` then match section or key. -- `TitleUnderscore`: it converts to format `title_underscore` then match section or key. - -To use them: - -```go -type Info struct { - PackageName string -} - -func main() { - err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("package_name=ini")) - // ... - - cfg, err := ini.Load([]byte("PACKAGE_NAME=ini")) - // ... - info := new(Info) - cfg.NameMapper = ini.AllCapsUnderscore - err = cfg.MapTo(info) - // ... -} -``` - -Same rules of name mapper apply to `ini.ReflectFromWithMapper` function. - -#### Value Mapper - -To expand values (e.g. from environment variables), you can use the `ValueMapper` to transform values: - -```go -type Env struct { - Foo string `ini:"foo"` -} - -func main() { - cfg, err := ini.Load([]byte("[env]\nfoo = ${MY_VAR}\n") - cfg.ValueMapper = os.ExpandEnv - // ... - env := &Env{} - err = cfg.Section("env").MapTo(env) -} -``` - -This would set the value of `env.Foo` to the value of the environment variable `MY_VAR`. - -#### Other Notes On Map/Reflect - -Any embedded struct is treated as a section by default, and there is no automatic parent-child relations in map/reflect feature: - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child -} - -type Config struct { - City string - Parent -} -``` - -Example configuration: - -```ini -City = Boston - -[Parent] -Name = Unknwon - -[Child] -Age = 21 -``` - -What if, yes, I'm paranoid, I want embedded struct to be in the same section. Well, all roads lead to Rome. - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child `ini:"Parent"` -} - -type Config struct { - City string - Parent -} -``` - -Example configuration: - -```ini -City = Boston - -[Parent] -Name = Unknwon -Age = 21 -``` - -## Getting Help - -- [API Documentation](https://gowalker.org/gopkg.in/ini.v1) -- [File An Issue](https://github.com/go-ini/ini/issues/new) - -## FAQs - -### What does `BlockMode` field do? - -By default, library lets you read and write values so we need a locker to make sure your data is safe. But in cases that you are very sure about only reading data through the library, you can set `cfg.BlockMode = false` to speed up read operations about **50-70%** faster. - -### Why another INI library? - -Many people are using my another INI library [goconfig](https://github.com/Unknwon/goconfig), so the reason for this one is I would like to make more Go style code. Also when you set `cfg.BlockMode = false`, this one is about **10-30%** faster. - -To make those changes I have to confirm API broken, so it's safer to keep it in another place and start using `gopkg.in` to version my package at this time.(PS: shorter import path) - -## License - -This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text. diff --git a/vendor/github.com/go-ini/ini/README_ZH.md b/vendor/github.com/go-ini/ini/README_ZH.md deleted file mode 100644 index 69aefef1..00000000 --- a/vendor/github.com/go-ini/ini/README_ZH.md +++ /dev/null @@ -1,750 +0,0 @@ -本包提供了 Go 语言中读写 INI 文件的功能。 - -## 功能特性 - -- 支持覆盖加载多个数据源(`[]byte`、文件和 `io.ReadCloser`) -- 支持递归读取键值 -- 支持读取父子分区 -- 支持读取自增键名 -- 支持读取多行的键值 -- 支持大量辅助方法 -- 支持在读取时直接转换为 Go 语言类型 -- 支持读取和 **写入** 分区和键的注释 -- 轻松操作分区、键值和注释 -- 在保存文件时分区和键值会保持原有的顺序 - -## 下载安装 - -使用一个特定版本: - - go get gopkg.in/ini.v1 - -使用最新版: - - go get github.com/go-ini/ini - -如需更新请添加 `-u` 选项。 - -### 测试安装 - -如果您想要在自己的机器上运行测试,请使用 `-t` 标记: - - go get -t gopkg.in/ini.v1 - -如需更新请添加 `-u` 选项。 - -## 开始使用 - -### 从数据源加载 - -一个 **数据源** 可以是 `[]byte` 类型的原始数据,`string` 类型的文件路径或 `io.ReadCloser`。您可以加载 **任意多个** 数据源。如果您传递其它类型的数据源,则会直接返回错误。 - -```go -cfg, err := ini.Load([]byte("raw data"), "filename", ioutil.NopCloser(bytes.NewReader([]byte("some other data")))) -``` - -或者从一个空白的文件开始: - -```go -cfg := ini.Empty() -``` - -当您在一开始无法决定需要加载哪些数据源时,仍可以使用 **Append()** 在需要的时候加载它们。 - -```go -err := cfg.Append("other file", []byte("other raw data")) -``` - -当您想要加载一系列文件,但是不能够确定其中哪些文件是不存在的,可以通过调用函数 `LooseLoad` 来忽略它们(`Load` 会因为文件不存在而返回错误): - -```go -cfg, err := ini.LooseLoad("filename", "filename_404") -``` - -更牛逼的是,当那些之前不存在的文件在重新调用 `Reload` 方法的时候突然出现了,那么它们会被正常加载。 - -#### 忽略键名的大小写 - -有时候分区和键的名称大小写混合非常烦人,这个时候就可以通过 `InsensitiveLoad` 将所有分区和键名在读取里强制转换为小写: - -```go -cfg, err := ini.InsensitiveLoad("filename") -//... - -// sec1 和 sec2 指向同一个分区对象 -sec1, err := cfg.GetSection("Section") -sec2, err := cfg.GetSection("SecTIOn") - -// key1 和 key2 指向同一个键对象 -key1, err := sec1.GetKey("Key") -key2, err := sec2.GetKey("KeY") -``` - -#### 类似 MySQL 配置中的布尔值键 - -MySQL 的配置文件中会出现没有具体值的布尔类型的键: - -```ini -[mysqld] -... -skip-host-cache -skip-name-resolve -``` - -默认情况下这被认为是缺失值而无法完成解析,但可以通过高级的加载选项对它们进行处理: - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{AllowBooleanKeys: true}, "my.cnf")) -``` - -这些键的值永远为 `true`,且在保存到文件时也只会输出键名。 - -如果您想要通过程序来生成此类键,则可以使用 `NewBooleanKey`: - -```go -key, err := sec.NewBooleanKey("skip-host-cache") -``` - -#### 关于注释 - -下述几种情况的内容将被视为注释: - -1. 所有以 `#` 或 `;` 开头的行 -2. 所有在 `#` 或 `;` 之后的内容 -3. 分区标签后的文字 (即 `[分区名]` 之后的内容) - -如果你希望使用包含 `#` 或 `;` 的值,请使用 ``` ` ``` 或 ``` """ ``` 进行包覆。 - -除此之外,您还可以通过 `LoadOptions` 完全忽略行内注释: - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: true}, "app.ini")) -``` - -### 操作分区(Section) - -获取指定分区: - -```go -section, err := cfg.GetSection("section name") -``` - -如果您想要获取默认分区,则可以用空字符串代替分区名: - -```go -section, err := cfg.GetSection("") -``` - -当您非常确定某个分区是存在的,可以使用以下简便方法: - -```go -section := cfg.Section("section name") -``` - -如果不小心判断错了,要获取的分区其实是不存在的,那会发生什么呢?没事的,它会自动创建并返回一个对应的分区对象给您。 - -创建一个分区: - -```go -err := cfg.NewSection("new section") -``` - -获取所有分区对象或名称: - -```go -sections := cfg.Sections() -names := cfg.SectionStrings() -``` - -### 操作键(Key) - -获取某个分区下的键: - -```go -key, err := cfg.Section("").GetKey("key name") -``` - -和分区一样,您也可以直接获取键而忽略错误处理: - -```go -key := cfg.Section("").Key("key name") -``` - -判断某个键是否存在: - -```go -yes := cfg.Section("").HasKey("key name") -``` - -创建一个新的键: - -```go -err := cfg.Section("").NewKey("name", "value") -``` - -获取分区下的所有键或键名: - -```go -keys := cfg.Section("").Keys() -names := cfg.Section("").KeyStrings() -``` - -获取分区下的所有键值对的克隆: - -```go -hash := cfg.Section("").KeysHash() -``` - -### 操作键值(Value) - -获取一个类型为字符串(string)的值: - -```go -val := cfg.Section("").Key("key name").String() -``` - -获取值的同时通过自定义函数进行处理验证: - -```go -val := cfg.Section("").Key("key name").Validate(func(in string) string { - if len(in) == 0 { - return "default" - } - return in -}) -``` - -如果您不需要任何对值的自动转变功能(例如递归读取),可以直接获取原值(这种方式性能最佳): - -```go -val := cfg.Section("").Key("key name").Value() -``` - -判断某个原值是否存在: - -```go -yes := cfg.Section("").HasValue("test value") -``` - -获取其它类型的值: - -```go -// 布尔值的规则: -// true 当值为:1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On -// false 当值为:0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off -v, err = cfg.Section("").Key("BOOL").Bool() -v, err = cfg.Section("").Key("FLOAT64").Float64() -v, err = cfg.Section("").Key("INT").Int() -v, err = cfg.Section("").Key("INT64").Int64() -v, err = cfg.Section("").Key("UINT").Uint() -v, err = cfg.Section("").Key("UINT64").Uint64() -v, err = cfg.Section("").Key("TIME").TimeFormat(time.RFC3339) -v, err = cfg.Section("").Key("TIME").Time() // RFC3339 - -v = cfg.Section("").Key("BOOL").MustBool() -v = cfg.Section("").Key("FLOAT64").MustFloat64() -v = cfg.Section("").Key("INT").MustInt() -v = cfg.Section("").Key("INT64").MustInt64() -v = cfg.Section("").Key("UINT").MustUint() -v = cfg.Section("").Key("UINT64").MustUint64() -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339) -v = cfg.Section("").Key("TIME").MustTime() // RFC3339 - -// 由 Must 开头的方法名允许接收一个相同类型的参数来作为默认值, -// 当键不存在或者转换失败时,则会直接返回该默认值。 -// 但是,MustString 方法必须传递一个默认值。 - -v = cfg.Seciont("").Key("String").MustString("default") -v = cfg.Section("").Key("BOOL").MustBool(true) -v = cfg.Section("").Key("FLOAT64").MustFloat64(1.25) -v = cfg.Section("").Key("INT").MustInt(10) -v = cfg.Section("").Key("INT64").MustInt64(99) -v = cfg.Section("").Key("UINT").MustUint(3) -v = cfg.Section("").Key("UINT64").MustUint64(6) -v = cfg.Section("").Key("TIME").MustTimeFormat(time.RFC3339, time.Now()) -v = cfg.Section("").Key("TIME").MustTime(time.Now()) // RFC3339 -``` - -如果我的值有好多行怎么办? - -```ini -[advance] -ADDRESS = """404 road, -NotFound, State, 5000 -Earth""" -``` - -嗯哼?小 case! - -```go -cfg.Section("advance").Key("ADDRESS").String() - -/* --- start --- -404 road, -NotFound, State, 5000 -Earth ------- end --- */ -``` - -赞爆了!那要是我属于一行的内容写不下想要写到第二行怎么办? - -```ini -[advance] -two_lines = how about \ - continuation lines? -lots_of_lines = 1 \ - 2 \ - 3 \ - 4 -``` - -简直是小菜一碟! - -```go -cfg.Section("advance").Key("two_lines").String() // how about continuation lines? -cfg.Section("advance").Key("lots_of_lines").String() // 1 2 3 4 -``` - -可是我有时候觉得两行连在一起特别没劲,怎么才能不自动连接两行呢? - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{ - IgnoreContinuation: true, -}, "filename") -``` - -哇靠给力啊! - -需要注意的是,值两侧的单引号会被自动剔除: - -```ini -foo = "some value" // foo: some value -bar = 'some value' // bar: some value -``` - -有时您会获得像从 [Crowdin](https://crowdin.com/) 网站下载的文件那样具有特殊格式的值(值使用双引号括起来,内部的双引号被转义): - -```ini -create_repo="创建了仓库 %s" -``` - -那么,怎么自动地将这类值进行处理呢? - -```go -cfg, err := ini.LoadSources(ini.LoadOptions{UnescapeValueDoubleQuotes: true}, "en-US.ini")) -cfg.Section("").Key("create_repo").String() -// You got: 创建了仓库 %s -``` - -这就是全部了?哈哈,当然不是。 - -#### 操作键值的辅助方法 - -获取键值时设定候选值: - -```go -v = cfg.Section("").Key("STRING").In("default", []string{"str", "arr", "types"}) -v = cfg.Section("").Key("FLOAT64").InFloat64(1.1, []float64{1.25, 2.5, 3.75}) -v = cfg.Section("").Key("INT").InInt(5, []int{10, 20, 30}) -v = cfg.Section("").Key("INT64").InInt64(10, []int64{10, 20, 30}) -v = cfg.Section("").Key("UINT").InUint(4, []int{3, 6, 9}) -v = cfg.Section("").Key("UINT64").InUint64(8, []int64{3, 6, 9}) -v = cfg.Section("").Key("TIME").InTimeFormat(time.RFC3339, time.Now(), []time.Time{time1, time2, time3}) -v = cfg.Section("").Key("TIME").InTime(time.Now(), []time.Time{time1, time2, time3}) // RFC3339 -``` - -如果获取到的值不是候选值的任意一个,则会返回默认值,而默认值不需要是候选值中的一员。 - -验证获取的值是否在指定范围内: - -```go -vals = cfg.Section("").Key("FLOAT64").RangeFloat64(0.0, 1.1, 2.2) -vals = cfg.Section("").Key("INT").RangeInt(0, 10, 20) -vals = cfg.Section("").Key("INT64").RangeInt64(0, 10, 20) -vals = cfg.Section("").Key("UINT").RangeUint(0, 3, 9) -vals = cfg.Section("").Key("UINT64").RangeUint64(0, 3, 9) -vals = cfg.Section("").Key("TIME").RangeTimeFormat(time.RFC3339, time.Now(), minTime, maxTime) -vals = cfg.Section("").Key("TIME").RangeTime(time.Now(), minTime, maxTime) // RFC3339 -``` - -##### 自动分割键值到切片(slice) - -当存在无效输入时,使用零值代替: - -```go -// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4] -// Input: how, 2.2, are, you -> [0.0 2.2 0.0 0.0] -vals = cfg.Section("").Key("STRINGS").Strings(",") -vals = cfg.Section("").Key("FLOAT64S").Float64s(",") -vals = cfg.Section("").Key("INTS").Ints(",") -vals = cfg.Section("").Key("INT64S").Int64s(",") -vals = cfg.Section("").Key("UINTS").Uints(",") -vals = cfg.Section("").Key("UINT64S").Uint64s(",") -vals = cfg.Section("").Key("TIMES").Times(",") -``` - -从结果切片中剔除无效输入: - -```go -// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4] -// Input: how, 2.2, are, you -> [2.2] -vals = cfg.Section("").Key("FLOAT64S").ValidFloat64s(",") -vals = cfg.Section("").Key("INTS").ValidInts(",") -vals = cfg.Section("").Key("INT64S").ValidInt64s(",") -vals = cfg.Section("").Key("UINTS").ValidUints(",") -vals = cfg.Section("").Key("UINT64S").ValidUint64s(",") -vals = cfg.Section("").Key("TIMES").ValidTimes(",") -``` - -当存在无效输入时,直接返回错误: - -```go -// Input: 1.1, 2.2, 3.3, 4.4 -> [1.1 2.2 3.3 4.4] -// Input: how, 2.2, are, you -> error -vals = cfg.Section("").Key("FLOAT64S").StrictFloat64s(",") -vals = cfg.Section("").Key("INTS").StrictInts(",") -vals = cfg.Section("").Key("INT64S").StrictInt64s(",") -vals = cfg.Section("").Key("UINTS").StrictUints(",") -vals = cfg.Section("").Key("UINT64S").StrictUint64s(",") -vals = cfg.Section("").Key("TIMES").StrictTimes(",") -``` - -### 保存配置 - -终于到了这个时刻,是时候保存一下配置了。 - -比较原始的做法是输出配置到某个文件: - -```go -// ... -err = cfg.SaveTo("my.ini") -err = cfg.SaveToIndent("my.ini", "\t") -``` - -另一个比较高级的做法是写入到任何实现 `io.Writer` 接口的对象中: - -```go -// ... -cfg.WriteTo(writer) -cfg.WriteToIndent(writer, "\t") -``` - -默认情况下,空格将被用于对齐键值之间的等号以美化输出结果,以下代码可以禁用该功能: - -```go -ini.PrettyFormat = false -``` - -## 高级用法 - -### 递归读取键值 - -在获取所有键值的过程中,特殊语法 `%()s` 会被应用,其中 `` 可以是相同分区或者默认分区下的键名。字符串 `%()s` 会被相应的键值所替代,如果指定的键不存在,则会用空字符串替代。您可以最多使用 99 层的递归嵌套。 - -```ini -NAME = ini - -[author] -NAME = Unknwon -GITHUB = https://github.com/%(NAME)s - -[package] -FULL_NAME = github.com/go-ini/%(NAME)s -``` - -```go -cfg.Section("author").Key("GITHUB").String() // https://github.com/Unknwon -cfg.Section("package").Key("FULL_NAME").String() // github.com/go-ini/ini -``` - -### 读取父子分区 - -您可以在分区名称中使用 `.` 来表示两个或多个分区之间的父子关系。如果某个键在子分区中不存在,则会去它的父分区中再次寻找,直到没有父分区为止。 - -```ini -NAME = ini -VERSION = v1 -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -[package] -CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] -``` - -```go -cfg.Section("package.sub").Key("CLONE_URL").String() // https://gopkg.in/ini.v1 -``` - -#### 获取上级父分区下的所有键名 - -```go -cfg.Section("package.sub").ParentKeys() // ["CLONE_URL"] -``` - -### 无法解析的分区 - -如果遇到一些比较特殊的分区,它们不包含常见的键值对,而是没有固定格式的纯文本,则可以使用 `LoadOptions.UnparsableSections` 进行处理: - -```go -cfg, err := LoadSources(ini.LoadOptions{UnparseableSections: []string{"COMMENTS"}}, `[COMMENTS] -<1> This slide has the fuel listed in the wrong units `)) - -body := cfg.Section("COMMENTS").Body() - -/* --- start --- -<1> This slide has the fuel listed in the wrong units ------- end --- */ -``` - -### 读取自增键名 - -如果数据源中的键名为 `-`,则认为该键使用了自增键名的特殊语法。计数器从 1 开始,并且分区之间是相互独立的。 - -```ini -[features] --: Support read/write comments of keys and sections --: Support auto-increment of key names --: Support load multiple files to overwrite key values -``` - -```go -cfg.Section("features").KeyStrings() // []{"#1", "#2", "#3"} -``` - -### 映射到结构 - -想要使用更加面向对象的方式玩转 INI 吗?好主意。 - -```ini -Name = Unknwon -age = 21 -Male = true -Born = 1993-01-01T20:17:05Z - -[Note] -Content = Hi is a good man! -Cities = HangZhou, Boston -``` - -```go -type Note struct { - Content string - Cities []string -} - -type Person struct { - Name string - Age int `ini:"age"` - Male bool - Born time.Time - Note - Created time.Time `ini:"-"` -} - -func main() { - cfg, err := ini.Load("path/to/ini") - // ... - p := new(Person) - err = cfg.MapTo(p) - // ... - - // 一切竟可以如此的简单。 - err = ini.MapTo(p, "path/to/ini") - // ... - - // 嗯哼?只需要映射一个分区吗? - n := new(Note) - err = cfg.Section("Note").MapTo(n) - // ... -} -``` - -结构的字段怎么设置默认值呢?很简单,只要在映射之前对指定字段进行赋值就可以了。如果键未找到或者类型错误,该值不会发生改变。 - -```go -// ... -p := &Person{ - Name: "Joe", -} -// ... -``` - -这样玩 INI 真的好酷啊!然而,如果不能还给我原来的配置文件,有什么卵用? - -### 从结构反射 - -可是,我有说不能吗? - -```go -type Embeded struct { - Dates []time.Time `delim:"|" comment:"Time data"` - Places []string `ini:"places,omitempty"` - None []int `ini:",omitempty"` -} - -type Author struct { - Name string `ini:"NAME"` - Male bool - Age int `comment:"Author's age"` - GPA float64 - NeverMind string `ini:"-"` - *Embeded `comment:"Embeded section"` -} - -func main() { - a := &Author{"Unknwon", true, 21, 2.8, "", - &Embeded{ - []time.Time{time.Now(), time.Now()}, - []string{"HangZhou", "Boston"}, - []int{}, - }} - cfg := ini.Empty() - err = ini.ReflectFrom(cfg, a) - // ... -} -``` - -瞧瞧,奇迹发生了。 - -```ini -NAME = Unknwon -Male = true -; Author's age -Age = 21 -GPA = 2.8 - -; Embeded section -[Embeded] -; Time data -Dates = 2015-08-07T22:14:22+08:00|2015-08-07T22:14:22+08:00 -places = HangZhou,Boston -``` - -#### 名称映射器(Name Mapper) - -为了节省您的时间并简化代码,本库支持类型为 [`NameMapper`](https://gowalker.org/gopkg.in/ini.v1#NameMapper) 的名称映射器,该映射器负责结构字段名与分区名和键名之间的映射。 - -目前有 2 款内置的映射器: - -- `AllCapsUnderscore`:该映射器将字段名转换至格式 `ALL_CAPS_UNDERSCORE` 后再去匹配分区名和键名。 -- `TitleUnderscore`:该映射器将字段名转换至格式 `title_underscore` 后再去匹配分区名和键名。 - -使用方法: - -```go -type Info struct{ - PackageName string -} - -func main() { - err = ini.MapToWithMapper(&Info{}, ini.TitleUnderscore, []byte("package_name=ini")) - // ... - - cfg, err := ini.Load([]byte("PACKAGE_NAME=ini")) - // ... - info := new(Info) - cfg.NameMapper = ini.AllCapsUnderscore - err = cfg.MapTo(info) - // ... -} -``` - -使用函数 `ini.ReflectFromWithMapper` 时也可应用相同的规则。 - -#### 值映射器(Value Mapper) - -值映射器允许使用一个自定义函数自动展开值的具体内容,例如:运行时获取环境变量: - -```go -type Env struct { - Foo string `ini:"foo"` -} - -func main() { - cfg, err := ini.Load([]byte("[env]\nfoo = ${MY_VAR}\n") - cfg.ValueMapper = os.ExpandEnv - // ... - env := &Env{} - err = cfg.Section("env").MapTo(env) -} -``` - -本例中,`env.Foo` 将会是运行时所获取到环境变量 `MY_VAR` 的值。 - -#### 映射/反射的其它说明 - -任何嵌入的结构都会被默认认作一个不同的分区,并且不会自动产生所谓的父子分区关联: - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child -} - -type Config struct { - City string - Parent -} -``` - -示例配置文件: - -```ini -City = Boston - -[Parent] -Name = Unknwon - -[Child] -Age = 21 -``` - -很好,但是,我就是要嵌入结构也在同一个分区。好吧,你爹是李刚! - -```go -type Child struct { - Age string -} - -type Parent struct { - Name string - Child `ini:"Parent"` -} - -type Config struct { - City string - Parent -} -``` - -示例配置文件: - -```ini -City = Boston - -[Parent] -Name = Unknwon -Age = 21 -``` - -## 获取帮助 - -- [API 文档](https://gowalker.org/gopkg.in/ini.v1) -- [创建工单](https://github.com/go-ini/ini/issues/new) - -## 常见问题 - -### 字段 `BlockMode` 是什么? - -默认情况下,本库会在您进行读写操作时采用锁机制来确保数据时间。但在某些情况下,您非常确定只进行读操作。此时,您可以通过设置 `cfg.BlockMode = false` 来将读操作提升大约 **50-70%** 的性能。 - -### 为什么要写另一个 INI 解析库? - -许多人都在使用我的 [goconfig](https://github.com/Unknwon/goconfig) 来完成对 INI 文件的操作,但我希望使用更加 Go 风格的代码。并且当您设置 `cfg.BlockMode = false` 时,会有大约 **10-30%** 的性能提升。 - -为了做出这些改变,我必须对 API 进行破坏,所以新开一个仓库是最安全的做法。除此之外,本库直接使用 `gopkg.in` 来进行版本化发布。(其实真相是导入路径更短了) diff --git a/vendor/github.com/go-ini/ini/error.go b/vendor/github.com/go-ini/ini/error.go deleted file mode 100644 index 80afe743..00000000 --- a/vendor/github.com/go-ini/ini/error.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "fmt" -) - -type ErrDelimiterNotFound struct { - Line string -} - -func IsErrDelimiterNotFound(err error) bool { - _, ok := err.(ErrDelimiterNotFound) - return ok -} - -func (err ErrDelimiterNotFound) Error() string { - return fmt.Sprintf("key-value delimiter not found: %s", err.Line) -} diff --git a/vendor/github.com/go-ini/ini/ini.go b/vendor/github.com/go-ini/ini/ini.go deleted file mode 100644 index 07dc62c5..00000000 --- a/vendor/github.com/go-ini/ini/ini.go +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -// Package ini provides INI file read and write functionality in Go. -package ini - -import ( - "bytes" - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "regexp" - "runtime" - "strings" - "sync" -) - -const ( - // Name for default section. You can use this constant or the string literal. - // In most of cases, an empty string is all you need to access the section. - DEFAULT_SECTION = "DEFAULT" - - // Maximum allowed depth when recursively substituing variable names. - _DEPTH_VALUES = 99 - _VERSION = "1.30.0" -) - -// Version returns current package version literal. -func Version() string { - return _VERSION -} - -var ( - // Delimiter to determine or compose a new line. - // This variable will be changed to "\r\n" automatically on Windows - // at package init time. - LineBreak = "\n" - - // Variable regexp pattern: %(variable)s - varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`) - - // Indicate whether to align "=" sign with spaces to produce pretty output - // or reduce all possible spaces for compact format. - PrettyFormat = true - - // Explicitly write DEFAULT section header - DefaultHeader = false - - // Indicate whether to put a line between sections - PrettySection = true -) - -func init() { - if runtime.GOOS == "windows" { - LineBreak = "\r\n" - } -} - -func inSlice(str string, s []string) bool { - for _, v := range s { - if str == v { - return true - } - } - return false -} - -// dataSource is an interface that returns object which can be read and closed. -type dataSource interface { - ReadCloser() (io.ReadCloser, error) -} - -// sourceFile represents an object that contains content on the local file system. -type sourceFile struct { - name string -} - -func (s sourceFile) ReadCloser() (_ io.ReadCloser, err error) { - return os.Open(s.name) -} - -type bytesReadCloser struct { - reader io.Reader -} - -func (rc *bytesReadCloser) Read(p []byte) (n int, err error) { - return rc.reader.Read(p) -} - -func (rc *bytesReadCloser) Close() error { - return nil -} - -// sourceData represents an object that contains content in memory. -type sourceData struct { - data []byte -} - -func (s *sourceData) ReadCloser() (io.ReadCloser, error) { - return ioutil.NopCloser(bytes.NewReader(s.data)), nil -} - -// sourceReadCloser represents an input stream with Close method. -type sourceReadCloser struct { - reader io.ReadCloser -} - -func (s *sourceReadCloser) ReadCloser() (io.ReadCloser, error) { - return s.reader, nil -} - -// File represents a combination of a or more INI file(s) in memory. -type File struct { - // Should make things safe, but sometimes doesn't matter. - BlockMode bool - // Make sure data is safe in multiple goroutines. - lock sync.RWMutex - - // Allow combination of multiple data sources. - dataSources []dataSource - // Actual data is stored here. - sections map[string]*Section - - // To keep data in order. - sectionList []string - - options LoadOptions - - NameMapper - ValueMapper -} - -// newFile initializes File object with given data sources. -func newFile(dataSources []dataSource, opts LoadOptions) *File { - return &File{ - BlockMode: true, - dataSources: dataSources, - sections: make(map[string]*Section), - sectionList: make([]string, 0, 10), - options: opts, - } -} - -func parseDataSource(source interface{}) (dataSource, error) { - switch s := source.(type) { - case string: - return sourceFile{s}, nil - case []byte: - return &sourceData{s}, nil - case io.ReadCloser: - return &sourceReadCloser{s}, nil - default: - return nil, fmt.Errorf("error parsing data source: unknown type '%s'", s) - } -} - -type LoadOptions struct { - // Loose indicates whether the parser should ignore nonexistent files or return error. - Loose bool - // Insensitive indicates whether the parser forces all section and key names to lowercase. - Insensitive bool - // IgnoreContinuation indicates whether to ignore continuation lines while parsing. - IgnoreContinuation bool - // IgnoreInlineComment indicates whether to ignore comments at the end of value and treat it as part of value. - IgnoreInlineComment bool - // AllowBooleanKeys indicates whether to allow boolean type keys or treat as value is missing. - // This type of keys are mostly used in my.cnf. - AllowBooleanKeys bool - // AllowShadows indicates whether to keep track of keys with same name under same section. - AllowShadows bool - // UnescapeValueDoubleQuotes indicates whether to unescape double quotes inside value to regular format when value is surrounded by double quotes, e.g. key="a \"value\"" => key=a "value" - UnescapeValueDoubleQuotes bool - // Some INI formats allow group blocks that store a block of raw content that doesn't otherwise - // conform to key/value pairs. Specify the names of those blocks here. - UnparseableSections []string -} - -func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) { - sources := make([]dataSource, len(others)+1) - sources[0], err = parseDataSource(source) - if err != nil { - return nil, err - } - for i := range others { - sources[i+1], err = parseDataSource(others[i]) - if err != nil { - return nil, err - } - } - f := newFile(sources, opts) - if err = f.Reload(); err != nil { - return nil, err - } - return f, nil -} - -// Load loads and parses from INI data sources. -// Arguments can be mixed of file name with string type, or raw data in []byte. -// It will return error if list contains nonexistent files. -func Load(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{}, source, others...) -} - -// LooseLoad has exactly same functionality as Load function -// except it ignores nonexistent files instead of returning error. -func LooseLoad(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{Loose: true}, source, others...) -} - -// InsensitiveLoad has exactly same functionality as Load function -// except it forces all section and key names to be lowercased. -func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{Insensitive: true}, source, others...) -} - -// InsensitiveLoad has exactly same functionality as Load function -// except it allows have shadow keys. -func ShadowLoad(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{AllowShadows: true}, source, others...) -} - -// Empty returns an empty file object. -func Empty() *File { - // Ignore error here, we sure our data is good. - f, _ := Load([]byte("")) - return f -} - -// NewSection creates a new section. -func (f *File) NewSection(name string) (*Section, error) { - if len(name) == 0 { - return nil, errors.New("error creating new section: empty section name") - } else if f.options.Insensitive && name != DEFAULT_SECTION { - name = strings.ToLower(name) - } - - if f.BlockMode { - f.lock.Lock() - defer f.lock.Unlock() - } - - if inSlice(name, f.sectionList) { - return f.sections[name], nil - } - - f.sectionList = append(f.sectionList, name) - f.sections[name] = newSection(f, name) - return f.sections[name], nil -} - -// NewRawSection creates a new section with an unparseable body. -func (f *File) NewRawSection(name, body string) (*Section, error) { - section, err := f.NewSection(name) - if err != nil { - return nil, err - } - - section.isRawSection = true - section.rawBody = body - return section, nil -} - -// NewSections creates a list of sections. -func (f *File) NewSections(names ...string) (err error) { - for _, name := range names { - if _, err = f.NewSection(name); err != nil { - return err - } - } - return nil -} - -// GetSection returns section by given name. -func (f *File) GetSection(name string) (*Section, error) { - if len(name) == 0 { - name = DEFAULT_SECTION - } else if f.options.Insensitive { - name = strings.ToLower(name) - } - - if f.BlockMode { - f.lock.RLock() - defer f.lock.RUnlock() - } - - sec := f.sections[name] - if sec == nil { - return nil, fmt.Errorf("section '%s' does not exist", name) - } - return sec, nil -} - -// Section assumes named section exists and returns a zero-value when not. -func (f *File) Section(name string) *Section { - sec, err := f.GetSection(name) - if err != nil { - // Note: It's OK here because the only possible error is empty section name, - // but if it's empty, this piece of code won't be executed. - sec, _ = f.NewSection(name) - return sec - } - return sec -} - -// Section returns list of Section. -func (f *File) Sections() []*Section { - sections := make([]*Section, len(f.sectionList)) - for i := range f.sectionList { - sections[i] = f.Section(f.sectionList[i]) - } - return sections -} - -// ChildSections returns a list of child sections of given section name. -func (f *File) ChildSections(name string) []*Section { - return f.Section(name).ChildSections() -} - -// SectionStrings returns list of section names. -func (f *File) SectionStrings() []string { - list := make([]string, len(f.sectionList)) - copy(list, f.sectionList) - return list -} - -// DeleteSection deletes a section. -func (f *File) DeleteSection(name string) { - if f.BlockMode { - f.lock.Lock() - defer f.lock.Unlock() - } - - if len(name) == 0 { - name = DEFAULT_SECTION - } - - for i, s := range f.sectionList { - if s == name { - f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...) - delete(f.sections, name) - return - } - } -} - -func (f *File) reload(s dataSource) error { - r, err := s.ReadCloser() - if err != nil { - return err - } - defer r.Close() - - return f.parse(r) -} - -// Reload reloads and parses all data sources. -func (f *File) Reload() (err error) { - for _, s := range f.dataSources { - if err = f.reload(s); err != nil { - // In loose mode, we create an empty default section for nonexistent files. - if os.IsNotExist(err) && f.options.Loose { - f.parse(bytes.NewBuffer(nil)) - continue - } - return err - } - } - return nil -} - -// Append appends one or more data sources and reloads automatically. -func (f *File) Append(source interface{}, others ...interface{}) error { - ds, err := parseDataSource(source) - if err != nil { - return err - } - f.dataSources = append(f.dataSources, ds) - for _, s := range others { - ds, err = parseDataSource(s) - if err != nil { - return err - } - f.dataSources = append(f.dataSources, ds) - } - return f.Reload() -} - -func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) { - equalSign := "=" - if PrettyFormat { - equalSign = " = " - } - - // Use buffer to make sure target is safe until finish encoding. - buf := bytes.NewBuffer(nil) - for i, sname := range f.sectionList { - sec := f.Section(sname) - if len(sec.Comment) > 0 { - if sec.Comment[0] != '#' && sec.Comment[0] != ';' { - sec.Comment = "; " + sec.Comment - } else { - sec.Comment = sec.Comment[:1] + " " + strings.TrimSpace(sec.Comment[1:]) - } - if _, err := buf.WriteString(sec.Comment + LineBreak); err != nil { - return nil, err - } - } - - if i > 0 || DefaultHeader { - if _, err := buf.WriteString("[" + sname + "]" + LineBreak); err != nil { - return nil, err - } - } else { - // Write nothing if default section is empty - if len(sec.keyList) == 0 { - continue - } - } - - if sec.isRawSection { - if _, err := buf.WriteString(sec.rawBody); err != nil { - return nil, err - } - continue - } - - // Count and generate alignment length and buffer spaces using the - // longest key. Keys may be modifed if they contain certain characters so - // we need to take that into account in our calculation. - alignLength := 0 - if PrettyFormat { - for _, kname := range sec.keyList { - keyLength := len(kname) - // First case will surround key by ` and second by """ - if strings.ContainsAny(kname, "\"=:") { - keyLength += 2 - } else if strings.Contains(kname, "`") { - keyLength += 6 - } - - if keyLength > alignLength { - alignLength = keyLength - } - } - } - alignSpaces := bytes.Repeat([]byte(" "), alignLength) - - KEY_LIST: - for _, kname := range sec.keyList { - key := sec.Key(kname) - if len(key.Comment) > 0 { - if len(indent) > 0 && sname != DEFAULT_SECTION { - buf.WriteString(indent) - } - if key.Comment[0] != '#' && key.Comment[0] != ';' { - key.Comment = "; " + key.Comment - } else { - key.Comment = key.Comment[:1] + " " + strings.TrimSpace(key.Comment[1:]) - } - if _, err := buf.WriteString(key.Comment + LineBreak); err != nil { - return nil, err - } - } - - if len(indent) > 0 && sname != DEFAULT_SECTION { - buf.WriteString(indent) - } - - switch { - case key.isAutoIncrement: - kname = "-" - case strings.ContainsAny(kname, "\"=:"): - kname = "`" + kname + "`" - case strings.Contains(kname, "`"): - kname = `"""` + kname + `"""` - } - - for _, val := range key.ValueWithShadows() { - if _, err := buf.WriteString(kname); err != nil { - return nil, err - } - - if key.isBooleanType { - if kname != sec.keyList[len(sec.keyList)-1] { - buf.WriteString(LineBreak) - } - continue KEY_LIST - } - - // Write out alignment spaces before "=" sign - if PrettyFormat { - buf.Write(alignSpaces[:alignLength-len(kname)]) - } - - // In case key value contains "\n", "`", "\"", "#" or ";" - if strings.ContainsAny(val, "\n`") { - val = `"""` + val + `"""` - } else if !f.options.IgnoreInlineComment && strings.ContainsAny(val, "#;") { - val = "`" + val + "`" - } - if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil { - return nil, err - } - } - } - - if PrettySection { - // Put a line between sections - if _, err := buf.WriteString(LineBreak); err != nil { - return nil, err - } - } - } - - return buf, nil -} - -// WriteToIndent writes content into io.Writer with given indention. -// If PrettyFormat has been set to be true, -// it will align "=" sign with spaces under each section. -func (f *File) WriteToIndent(w io.Writer, indent string) (int64, error) { - buf, err := f.writeToBuffer(indent) - if err != nil { - return 0, err - } - return buf.WriteTo(w) -} - -// WriteTo writes file content into io.Writer. -func (f *File) WriteTo(w io.Writer) (int64, error) { - return f.WriteToIndent(w, "") -} - -// SaveToIndent writes content to file system with given value indention. -func (f *File) SaveToIndent(filename, indent string) error { - // Note: Because we are truncating with os.Create, - // so it's safer to save to a temporary file location and rename afte done. - buf, err := f.writeToBuffer(indent) - if err != nil { - return err - } - - return ioutil.WriteFile(filename, buf.Bytes(), 0666) -} - -// SaveTo writes content to file system. -func (f *File) SaveTo(filename string) error { - return f.SaveToIndent(filename, "") -} diff --git a/vendor/github.com/go-ini/ini/ini_test.go b/vendor/github.com/go-ini/ini/ini_test.go deleted file mode 100644 index c20ff3dd..00000000 --- a/vendor/github.com/go-ini/ini/ini_test.go +++ /dev/null @@ -1,518 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bytes" - "io/ioutil" - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" -) - -func Test_Version(t *testing.T) { - Convey("Get version", t, func() { - So(Version(), ShouldEqual, _VERSION) - }) -} - -const _CONF_DATA = ` -; Package name -NAME = ini -; Package version -VERSION = v1 -; Package import path -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -# Information about package author -# Bio can be written in multiple lines. -[author] -NAME = Unknwon ; Succeeding comment -E-MAIL = fake@localhost -GITHUB = https://github.com/%(NAME)s -BIO = """Gopher. -Coding addict. -Good man. -""" # Succeeding comment - -[package] -CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] -UNUSED_KEY = should be deleted - -[features] --: Support read/write comments of keys and sections --: Support auto-increment of key names --: Support load multiple files to overwrite key values - -[types] -STRING = str -BOOL = true -BOOL_FALSE = false -FLOAT64 = 1.25 -INT = 10 -TIME = 2015-01-01T20:17:05Z -DURATION = 2h45m -UINT = 3 - -[array] -STRINGS = en, zh, de -FLOAT64S = 1.1, 2.2, 3.3 -INTS = 1, 2, 3 -UINTS = 1, 2, 3 -TIMES = 2015-01-01T20:17:05Z,2015-01-01T20:17:05Z,2015-01-01T20:17:05Z - -[note] -empty_lines = next line is empty\ - -; Comment before the section -[comments] ; This is a comment for the section too -; Comment before key -key = "value" -key2 = "value2" ; This is a comment for key2 -key3 = "one", "two", "three" - -[string escapes] -key1 = value1, value2, value3 -key2 = value1\, value2 -key3 = val\ue1, value2 -key4 = value1\\, value\\\\2 -key5 = value1\,, value2 -key6 = aaa bbb\ and\ space ccc - -[advance] -value with quotes = "some value" -value quote2 again = 'some value' -includes comment sign = ` + "`" + "my#password" + "`" + ` -includes comment sign2 = ` + "`" + "my;password" + "`" + ` -true = 2+3=5 -"1+1=2" = true -"""6+1=7""" = true -"""` + "`" + `5+5` + "`" + `""" = 10 -` + "`" + `"6+6"` + "`" + ` = 12 -` + "`" + `7-2=4` + "`" + ` = false -ADDRESS = ` + "`" + `404 road, -NotFound, State, 50000` + "`" + ` - -two_lines = how about \ - continuation lines? -lots_of_lines = 1 \ - 2 \ - 3 \ - 4 \ -` - -func Test_Load(t *testing.T) { - Convey("Load from data sources", t, func() { - - Convey("Load with empty data", func() { - So(Empty(), ShouldNotBeNil) - }) - - Convey("Load with multiple data sources", func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini", ioutil.NopCloser(bytes.NewReader([]byte(_CONF_DATA)))) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - f, err := Load([]byte(_CONF_DATA), "testdata/404.ini") - So(err, ShouldNotBeNil) - So(f, ShouldBeNil) - }) - - Convey("Load with io.ReadCloser", func() { - cfg, err := Load(ioutil.NopCloser(bytes.NewReader([]byte(_CONF_DATA)))) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Section("").Key("NAME").String(), ShouldEqual, "ini") - }) - }) - - Convey("Bad load process", t, func() { - - Convey("Load from invalid data sources", func() { - _, err := Load(_CONF_DATA) - So(err, ShouldNotBeNil) - - f, err := Load("testdata/404.ini") - So(err, ShouldNotBeNil) - So(f, ShouldBeNil) - - _, err = Load(1) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(""), 1) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad section name", func() { - _, err := Load([]byte("[]")) - So(err, ShouldNotBeNil) - - _, err = Load([]byte("[")) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad keys", func() { - _, err := Load([]byte(`"""name`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`"""name"""`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`""=1`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`=`)) - So(err, ShouldNotBeNil) - - _, err = Load([]byte(`name`)) - So(err, ShouldNotBeNil) - }) - - Convey("Load with bad values", func() { - _, err := Load([]byte(`name="""Unknwon`)) - So(err, ShouldNotBeNil) - }) - }) - - Convey("Get section and key insensitively", t, func() { - cfg, err := InsensitiveLoad([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - sec, err := cfg.GetSection("Author") - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - - key, err := sec.GetKey("E-mail") - So(err, ShouldBeNil) - So(key, ShouldNotBeNil) - }) - - Convey("Load with ignoring continuation lines", t, func() { - cfg, err := LoadSources(LoadOptions{IgnoreContinuation: true}, []byte(`key1=a\b\ -key2=c\d\`)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Section("").Key("key1").String(), ShouldEqual, `a\b\`) - So(cfg.Section("").Key("key2").String(), ShouldEqual, `c\d\`) - }) - - Convey("Load with ignoring inline comments", t, func() { - cfg, err := LoadSources(LoadOptions{IgnoreInlineComment: true}, []byte(`key1=value ;comment -key2=value #comment2`)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Section("").Key("key1").String(), ShouldEqual, `value ;comment`) - So(cfg.Section("").Key("key2").String(), ShouldEqual, `value #comment2`) - - var buf bytes.Buffer - cfg.WriteTo(&buf) - So(buf.String(), ShouldEqual, `key1 = value ;comment -key2 = value #comment2 - -`) - }) - - Convey("Load with boolean type keys", t, func() { - cfg, err := LoadSources(LoadOptions{AllowBooleanKeys: true}, []byte(`key1=hello -key2 -#key3 -key4 -key5`)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(strings.Join(cfg.Section("").KeyStrings(), ","), ShouldEqual, "key1,key2,key4,key5") - So(cfg.Section("").Key("key2").MustBool(false), ShouldBeTrue) - - var buf bytes.Buffer - cfg.WriteTo(&buf) - // there is always a trailing \n at the end of the section - So(buf.String(), ShouldEqual, `key1 = hello -key2 -# key3 -key4 -key5 -`) - }) -} - -func Test_File_ChildSections(t *testing.T) { - Convey("Find child sections by parent name", t, func() { - cfg, err := Load([]byte(` -[node] - -[node.biz1] - -[node.biz2] - -[node.biz3] - -[node.bizN] -`)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - children := cfg.ChildSections("node") - names := make([]string, len(children)) - for i := range children { - names[i] = children[i].name - } - So(strings.Join(names, ","), ShouldEqual, "node.biz1,node.biz2,node.biz3,node.bizN") - }) -} - -func Test_LooseLoad(t *testing.T) { - Convey("Loose load from data sources", t, func() { - Convey("Loose load mixed with nonexistent file", func() { - cfg, err := LooseLoad("testdata/404.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - var fake struct { - Name string `ini:"name"` - } - So(cfg.MapTo(&fake), ShouldBeNil) - - cfg, err = LooseLoad([]byte("name=Unknwon"), "testdata/404.ini") - So(err, ShouldBeNil) - So(cfg.Section("").Key("name").String(), ShouldEqual, "Unknwon") - So(cfg.MapTo(&fake), ShouldBeNil) - So(fake.Name, ShouldEqual, "Unknwon") - }) - }) - -} - -func Test_LoadOptions_UnescapeValueDoubleQuotes(t *testing.T) { - Convey("Load with option UnescapeValueDoubleQuotes enabled", t, func() { - cfg, err := LoadSources(LoadOptions{UnescapeValueDoubleQuotes: true}, - []byte(`create_repo="创建了仓库 %s"`)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Section("").Key("create_repo").String(), ShouldEqual, `创建了仓库 %s`) - }) -} - -func Test_File_Append(t *testing.T) { - Convey("Append data sources", t, func() { - cfg, err := Load([]byte("")) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Append([]byte(""), []byte("")), ShouldBeNil) - - Convey("Append bad data sources", func() { - So(cfg.Append(1), ShouldNotBeNil) - So(cfg.Append([]byte(""), 1), ShouldNotBeNil) - }) - }) -} - -func Test_File_WriteTo(t *testing.T) { - Convey("Write to somewhere", t, func() { - var buf bytes.Buffer - cfg := Empty() - cfg.WriteTo(&buf) - }) -} - -func Test_File_SaveTo_WriteTo(t *testing.T) { - Convey("Save file", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.Section("").Key("NAME").Comment = "Package name" - cfg.Section("author").Comment = `Information about package author -# Bio can be written in multiple lines.` - cfg.Section("advanced").Key("val w/ pound").SetValue("my#password") - cfg.Section("advanced").Key("longest key has a colon : yes/no").SetValue("yes") - So(cfg.SaveTo("testdata/conf_out.ini"), ShouldBeNil) - - cfg.Section("author").Key("NAME").Comment = "This is author name" - - So(cfg.SaveToIndent("testdata/conf_out.ini", "\t"), ShouldBeNil) - - var buf bytes.Buffer - _, err = cfg.WriteToIndent(&buf, "\t") - So(err, ShouldBeNil) - So(buf.String(), ShouldEqual, `; Package name -NAME = ini -; Package version -VERSION = v1 -; Package import path -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s - -; Information about package author -# Bio can be written in multiple lines. -[author] - ; This is author name - NAME = Unknwon - E-MAIL = u@gogs.io - GITHUB = https://github.com/%(NAME)s - # Succeeding comment - BIO = """Gopher. -Coding addict. -Good man. -""" - -[package] - CLONE_URL = https://%(IMPORT_PATH)s - -[package.sub] - UNUSED_KEY = should be deleted - -[features] - - = Support read/write comments of keys and sections - - = Support auto-increment of key names - - = Support load multiple files to overwrite key values - -[types] - STRING = str - BOOL = true - BOOL_FALSE = false - FLOAT64 = 1.25 - INT = 10 - TIME = 2015-01-01T20:17:05Z - DURATION = 2h45m - UINT = 3 - -[array] - STRINGS = en, zh, de - FLOAT64S = 1.1, 2.2, 3.3 - INTS = 1, 2, 3 - UINTS = 1, 2, 3 - TIMES = 2015-01-01T20:17:05Z,2015-01-01T20:17:05Z,2015-01-01T20:17:05Z - -[note] - empty_lines = next line is empty - -; Comment before the section -; This is a comment for the section too -[comments] - ; Comment before key - key = value - ; This is a comment for key2 - key2 = value2 - key3 = "one", "two", "three" - -[string escapes] - key1 = value1, value2, value3 - key2 = value1\, value2 - key3 = val\ue1, value2 - key4 = value1\\, value\\\\2 - key5 = value1\,, value2 - key6 = aaa bbb\ and\ space ccc - -[advance] - value with quotes = some value - value quote2 again = some value - includes comment sign = `+"`"+"my#password"+"`"+` - includes comment sign2 = `+"`"+"my;password"+"`"+` - true = 2+3=5 - `+"`"+`1+1=2`+"`"+` = true - `+"`"+`6+1=7`+"`"+` = true - """`+"`"+`5+5`+"`"+`""" = 10 - `+"`"+`"6+6"`+"`"+` = 12 - `+"`"+`7-2=4`+"`"+` = false - ADDRESS = """404 road, -NotFound, State, 50000""" - two_lines = how about continuation lines? - lots_of_lines = 1 2 3 4 - -[advanced] - val w/ pound = `+"`"+`my#password`+"`"+` - `+"`"+`longest key has a colon : yes/no`+"`"+` = yes - -`) - }) -} - -func Test_File_WriteTo_SectionRaw(t *testing.T) { - Convey("Write a INI with a raw section", t, func() { - var buf bytes.Buffer - cfg, err := LoadSources( - LoadOptions{ - UnparseableSections: []string{"CORE_LESSON", "COMMENTS"}, - }, - "testdata/aicc.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - cfg.WriteToIndent(&buf, "\t") - So(buf.String(), ShouldEqual, `[Core] - Lesson_Location = 87 - Lesson_Status = C - Score = 3 - Time = 00:02:30 - -[CORE_LESSON] -my lesson state data – 1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000 – end my lesson state data -[COMMENTS] -<1> This slide has the fuel listed in the wrong units -`) - }) -} - -// Helpers for slice tests. -func float64sEqual(values []float64, expected ...float64) { - So(values, ShouldHaveLength, len(expected)) - for i, v := range expected { - So(values[i], ShouldEqual, v) - } -} - -func intsEqual(values []int, expected ...int) { - So(values, ShouldHaveLength, len(expected)) - for i, v := range expected { - So(values[i], ShouldEqual, v) - } -} - -func int64sEqual(values []int64, expected ...int64) { - So(values, ShouldHaveLength, len(expected)) - for i, v := range expected { - So(values[i], ShouldEqual, v) - } -} - -func uintsEqual(values []uint, expected ...uint) { - So(values, ShouldHaveLength, len(expected)) - for i, v := range expected { - So(values[i], ShouldEqual, v) - } -} - -func uint64sEqual(values []uint64, expected ...uint64) { - So(values, ShouldHaveLength, len(expected)) - for i, v := range expected { - So(values[i], ShouldEqual, v) - } -} - -func timesEqual(values []time.Time, expected ...time.Time) { - So(values, ShouldHaveLength, len(expected)) - for i, v := range expected { - So(values[i].String(), ShouldEqual, v.String()) - } -} diff --git a/vendor/github.com/go-ini/ini/key.go b/vendor/github.com/go-ini/ini/key.go deleted file mode 100644 index 0a2aa30e..00000000 --- a/vendor/github.com/go-ini/ini/key.go +++ /dev/null @@ -1,728 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bytes" - "errors" - "fmt" - "strconv" - "strings" - "time" -) - -// Key represents a key under a section. -type Key struct { - s *Section - name string - value string - isAutoIncrement bool - isBooleanType bool - - isShadow bool - shadows []*Key - - Comment string -} - -// newKey simply return a key object with given values. -func newKey(s *Section, name, val string) *Key { - return &Key{ - s: s, - name: name, - value: val, - } -} - -func (k *Key) addShadow(val string) error { - if k.isShadow { - return errors.New("cannot add shadow to another shadow key") - } else if k.isAutoIncrement || k.isBooleanType { - return errors.New("cannot add shadow to auto-increment or boolean key") - } - - shadow := newKey(k.s, k.name, val) - shadow.isShadow = true - k.shadows = append(k.shadows, shadow) - return nil -} - -// AddShadow adds a new shadow key to itself. -func (k *Key) AddShadow(val string) error { - if !k.s.f.options.AllowShadows { - return errors.New("shadow key is not allowed") - } - return k.addShadow(val) -} - -// ValueMapper represents a mapping function for values, e.g. os.ExpandEnv -type ValueMapper func(string) string - -// Name returns name of key. -func (k *Key) Name() string { - return k.name -} - -// Value returns raw value of key for performance purpose. -func (k *Key) Value() string { - return k.value -} - -// ValueWithShadows returns raw values of key and its shadows if any. -func (k *Key) ValueWithShadows() []string { - if len(k.shadows) == 0 { - return []string{k.value} - } - vals := make([]string, len(k.shadows)+1) - vals[0] = k.value - for i := range k.shadows { - vals[i+1] = k.shadows[i].value - } - return vals -} - -// transformValue takes a raw value and transforms to its final string. -func (k *Key) transformValue(val string) string { - if k.s.f.ValueMapper != nil { - val = k.s.f.ValueMapper(val) - } - - // Fail-fast if no indicate char found for recursive value - if !strings.Contains(val, "%") { - return val - } - for i := 0; i < _DEPTH_VALUES; i++ { - vr := varPattern.FindString(val) - if len(vr) == 0 { - break - } - - // Take off leading '%(' and trailing ')s'. - noption := strings.TrimLeft(vr, "%(") - noption = strings.TrimRight(noption, ")s") - - // Search in the same section. - nk, err := k.s.GetKey(noption) - if err != nil { - // Search again in default section. - nk, _ = k.s.f.Section("").GetKey(noption) - } - - // Substitute by new value and take off leading '%(' and trailing ')s'. - val = strings.Replace(val, vr, nk.value, -1) - } - return val -} - -// String returns string representation of value. -func (k *Key) String() string { - return k.transformValue(k.value) -} - -// Validate accepts a validate function which can -// return modifed result as key value. -func (k *Key) Validate(fn func(string) string) string { - return fn(k.String()) -} - -// parseBool returns the boolean value represented by the string. -// -// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On, -// 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off. -// Any other value returns an error. -func parseBool(str string) (value bool, err error) { - switch str { - case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On": - return true, nil - case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off": - return false, nil - } - return false, fmt.Errorf("parsing \"%s\": invalid syntax", str) -} - -// Bool returns bool type value. -func (k *Key) Bool() (bool, error) { - return parseBool(k.String()) -} - -// Float64 returns float64 type value. -func (k *Key) Float64() (float64, error) { - return strconv.ParseFloat(k.String(), 64) -} - -// Int returns int type value. -func (k *Key) Int() (int, error) { - return strconv.Atoi(k.String()) -} - -// Int64 returns int64 type value. -func (k *Key) Int64() (int64, error) { - return strconv.ParseInt(k.String(), 10, 64) -} - -// Uint returns uint type valued. -func (k *Key) Uint() (uint, error) { - u, e := strconv.ParseUint(k.String(), 10, 64) - return uint(u), e -} - -// Uint64 returns uint64 type value. -func (k *Key) Uint64() (uint64, error) { - return strconv.ParseUint(k.String(), 10, 64) -} - -// Duration returns time.Duration type value. -func (k *Key) Duration() (time.Duration, error) { - return time.ParseDuration(k.String()) -} - -// TimeFormat parses with given format and returns time.Time type value. -func (k *Key) TimeFormat(format string) (time.Time, error) { - return time.Parse(format, k.String()) -} - -// Time parses with RFC3339 format and returns time.Time type value. -func (k *Key) Time() (time.Time, error) { - return k.TimeFormat(time.RFC3339) -} - -// MustString returns default value if key value is empty. -func (k *Key) MustString(defaultVal string) string { - val := k.String() - if len(val) == 0 { - k.value = defaultVal - return defaultVal - } - return val -} - -// MustBool always returns value without error, -// it returns false if error occurs. -func (k *Key) MustBool(defaultVal ...bool) bool { - val, err := k.Bool() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatBool(defaultVal[0]) - return defaultVal[0] - } - return val -} - -// MustFloat64 always returns value without error, -// it returns 0.0 if error occurs. -func (k *Key) MustFloat64(defaultVal ...float64) float64 { - val, err := k.Float64() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatFloat(defaultVal[0], 'f', -1, 64) - return defaultVal[0] - } - return val -} - -// MustInt always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustInt(defaultVal ...int) int { - val, err := k.Int() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatInt(int64(defaultVal[0]), 10) - return defaultVal[0] - } - return val -} - -// MustInt64 always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustInt64(defaultVal ...int64) int64 { - val, err := k.Int64() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatInt(defaultVal[0], 10) - return defaultVal[0] - } - return val -} - -// MustUint always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustUint(defaultVal ...uint) uint { - val, err := k.Uint() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatUint(uint64(defaultVal[0]), 10) - return defaultVal[0] - } - return val -} - -// MustUint64 always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustUint64(defaultVal ...uint64) uint64 { - val, err := k.Uint64() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatUint(defaultVal[0], 10) - return defaultVal[0] - } - return val -} - -// MustDuration always returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration { - val, err := k.Duration() - if len(defaultVal) > 0 && err != nil { - k.value = defaultVal[0].String() - return defaultVal[0] - } - return val -} - -// MustTimeFormat always parses with given format and returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time { - val, err := k.TimeFormat(format) - if len(defaultVal) > 0 && err != nil { - k.value = defaultVal[0].Format(format) - return defaultVal[0] - } - return val -} - -// MustTime always parses with RFC3339 format and returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustTime(defaultVal ...time.Time) time.Time { - return k.MustTimeFormat(time.RFC3339, defaultVal...) -} - -// In always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) In(defaultVal string, candidates []string) string { - val := k.String() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InFloat64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 { - val := k.MustFloat64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InInt always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InInt(defaultVal int, candidates []int) int { - val := k.MustInt() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InInt64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 { - val := k.MustInt64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InUint always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InUint(defaultVal uint, candidates []uint) uint { - val := k.MustUint() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InUint64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 { - val := k.MustUint64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InTimeFormat always parses with given format and returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time { - val := k.MustTimeFormat(format) - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InTime always parses with RFC3339 format and returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time { - return k.InTimeFormat(time.RFC3339, defaultVal, candidates) -} - -// RangeFloat64 checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 { - val := k.MustFloat64() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeInt checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeInt(defaultVal, min, max int) int { - val := k.MustInt() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeInt64 checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeInt64(defaultVal, min, max int64) int64 { - val := k.MustInt64() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeTimeFormat checks if value with given format is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time { - val := k.MustTimeFormat(format) - if val.Unix() < min.Unix() || val.Unix() > max.Unix() { - return defaultVal - } - return val -} - -// RangeTime checks if value with RFC3339 format is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time { - return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max) -} - -// Strings returns list of string divided by given delimiter. -func (k *Key) Strings(delim string) []string { - str := k.String() - if len(str) == 0 { - return []string{} - } - - runes := []rune(str) - vals := make([]string, 0, 2) - var buf bytes.Buffer - escape := false - idx := 0 - for { - if escape { - escape = false - if runes[idx] != '\\' && !strings.HasPrefix(string(runes[idx:]), delim) { - buf.WriteRune('\\') - } - buf.WriteRune(runes[idx]) - } else { - if runes[idx] == '\\' { - escape = true - } else if strings.HasPrefix(string(runes[idx:]), delim) { - idx += len(delim) - 1 - vals = append(vals, strings.TrimSpace(buf.String())) - buf.Reset() - } else { - buf.WriteRune(runes[idx]) - } - } - idx += 1 - if idx == len(runes) { - break - } - } - - if buf.Len() > 0 { - vals = append(vals, strings.TrimSpace(buf.String())) - } - - return vals -} - -// StringsWithShadows returns list of string divided by given delimiter. -// Shadows will also be appended if any. -func (k *Key) StringsWithShadows(delim string) []string { - vals := k.ValueWithShadows() - results := make([]string, 0, len(vals)*2) - for i := range vals { - if len(vals) == 0 { - continue - } - - results = append(results, strings.Split(vals[i], delim)...) - } - - for i := range results { - results[i] = k.transformValue(strings.TrimSpace(results[i])) - } - return results -} - -// Float64s returns list of float64 divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Float64s(delim string) []float64 { - vals, _ := k.parseFloat64s(k.Strings(delim), true, false) - return vals -} - -// Ints returns list of int divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Ints(delim string) []int { - vals, _ := k.parseInts(k.Strings(delim), true, false) - return vals -} - -// Int64s returns list of int64 divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Int64s(delim string) []int64 { - vals, _ := k.parseInt64s(k.Strings(delim), true, false) - return vals -} - -// Uints returns list of uint divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Uints(delim string) []uint { - vals, _ := k.parseUints(k.Strings(delim), true, false) - return vals -} - -// Uint64s returns list of uint64 divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Uint64s(delim string) []uint64 { - vals, _ := k.parseUint64s(k.Strings(delim), true, false) - return vals -} - -// TimesFormat parses with given format and returns list of time.Time divided by given delimiter. -// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC). -func (k *Key) TimesFormat(format, delim string) []time.Time { - vals, _ := k.parseTimesFormat(format, k.Strings(delim), true, false) - return vals -} - -// Times parses with RFC3339 format and returns list of time.Time divided by given delimiter. -// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC). -func (k *Key) Times(delim string) []time.Time { - return k.TimesFormat(time.RFC3339, delim) -} - -// ValidFloat64s returns list of float64 divided by given delimiter. If some value is not float, then -// it will not be included to result list. -func (k *Key) ValidFloat64s(delim string) []float64 { - vals, _ := k.parseFloat64s(k.Strings(delim), false, false) - return vals -} - -// ValidInts returns list of int divided by given delimiter. If some value is not integer, then it will -// not be included to result list. -func (k *Key) ValidInts(delim string) []int { - vals, _ := k.parseInts(k.Strings(delim), false, false) - return vals -} - -// ValidInt64s returns list of int64 divided by given delimiter. If some value is not 64-bit integer, -// then it will not be included to result list. -func (k *Key) ValidInt64s(delim string) []int64 { - vals, _ := k.parseInt64s(k.Strings(delim), false, false) - return vals -} - -// ValidUints returns list of uint divided by given delimiter. If some value is not unsigned integer, -// then it will not be included to result list. -func (k *Key) ValidUints(delim string) []uint { - vals, _ := k.parseUints(k.Strings(delim), false, false) - return vals -} - -// ValidUint64s returns list of uint64 divided by given delimiter. If some value is not 64-bit unsigned -// integer, then it will not be included to result list. -func (k *Key) ValidUint64s(delim string) []uint64 { - vals, _ := k.parseUint64s(k.Strings(delim), false, false) - return vals -} - -// ValidTimesFormat parses with given format and returns list of time.Time divided by given delimiter. -func (k *Key) ValidTimesFormat(format, delim string) []time.Time { - vals, _ := k.parseTimesFormat(format, k.Strings(delim), false, false) - return vals -} - -// ValidTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter. -func (k *Key) ValidTimes(delim string) []time.Time { - return k.ValidTimesFormat(time.RFC3339, delim) -} - -// StrictFloat64s returns list of float64 divided by given delimiter or error on first invalid input. -func (k *Key) StrictFloat64s(delim string) ([]float64, error) { - return k.parseFloat64s(k.Strings(delim), false, true) -} - -// StrictInts returns list of int divided by given delimiter or error on first invalid input. -func (k *Key) StrictInts(delim string) ([]int, error) { - return k.parseInts(k.Strings(delim), false, true) -} - -// StrictInt64s returns list of int64 divided by given delimiter or error on first invalid input. -func (k *Key) StrictInt64s(delim string) ([]int64, error) { - return k.parseInt64s(k.Strings(delim), false, true) -} - -// StrictUints returns list of uint divided by given delimiter or error on first invalid input. -func (k *Key) StrictUints(delim string) ([]uint, error) { - return k.parseUints(k.Strings(delim), false, true) -} - -// StrictUint64s returns list of uint64 divided by given delimiter or error on first invalid input. -func (k *Key) StrictUint64s(delim string) ([]uint64, error) { - return k.parseUint64s(k.Strings(delim), false, true) -} - -// StrictTimesFormat parses with given format and returns list of time.Time divided by given delimiter -// or error on first invalid input. -func (k *Key) StrictTimesFormat(format, delim string) ([]time.Time, error) { - return k.parseTimesFormat(format, k.Strings(delim), false, true) -} - -// StrictTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter -// or error on first invalid input. -func (k *Key) StrictTimes(delim string) ([]time.Time, error) { - return k.StrictTimesFormat(time.RFC3339, delim) -} - -// parseFloat64s transforms strings to float64s. -func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]float64, error) { - vals := make([]float64, 0, len(strs)) - for _, str := range strs { - val, err := strconv.ParseFloat(str, 64) - if err != nil && returnOnInvalid { - return nil, err - } - if err == nil || addInvalid { - vals = append(vals, val) - } - } - return vals, nil -} - -// parseInts transforms strings to ints. -func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) { - vals := make([]int, 0, len(strs)) - for _, str := range strs { - val, err := strconv.Atoi(str) - if err != nil && returnOnInvalid { - return nil, err - } - if err == nil || addInvalid { - vals = append(vals, val) - } - } - return vals, nil -} - -// parseInt64s transforms strings to int64s. -func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) { - vals := make([]int64, 0, len(strs)) - for _, str := range strs { - val, err := strconv.ParseInt(str, 10, 64) - if err != nil && returnOnInvalid { - return nil, err - } - if err == nil || addInvalid { - vals = append(vals, val) - } - } - return vals, nil -} - -// parseUints transforms strings to uints. -func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) { - vals := make([]uint, 0, len(strs)) - for _, str := range strs { - val, err := strconv.ParseUint(str, 10, 0) - if err != nil && returnOnInvalid { - return nil, err - } - if err == nil || addInvalid { - vals = append(vals, uint(val)) - } - } - return vals, nil -} - -// parseUint64s transforms strings to uint64s. -func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]uint64, error) { - vals := make([]uint64, 0, len(strs)) - for _, str := range strs { - val, err := strconv.ParseUint(str, 10, 64) - if err != nil && returnOnInvalid { - return nil, err - } - if err == nil || addInvalid { - vals = append(vals, val) - } - } - return vals, nil -} - -// parseTimesFormat transforms strings to times in given format. -func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) { - vals := make([]time.Time, 0, len(strs)) - for _, str := range strs { - val, err := time.Parse(format, str) - if err != nil && returnOnInvalid { - return nil, err - } - if err == nil || addInvalid { - vals = append(vals, val) - } - } - return vals, nil -} - -// SetValue changes key value. -func (k *Key) SetValue(v string) { - if k.s.f.BlockMode { - k.s.f.lock.Lock() - defer k.s.f.lock.Unlock() - } - - k.value = v - k.s.keysHash[k.name] = v -} diff --git a/vendor/github.com/go-ini/ini/key_test.go b/vendor/github.com/go-ini/ini/key_test.go deleted file mode 100644 index a70ee64c..00000000 --- a/vendor/github.com/go-ini/ini/key_test.go +++ /dev/null @@ -1,583 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bytes" - "fmt" - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" -) - -func Test_Key(t *testing.T) { - Convey("Test getting and setting values", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Get values in default section", func() { - sec := cfg.Section("") - So(sec, ShouldNotBeNil) - So(sec.Key("NAME").Value(), ShouldEqual, "ini") - So(sec.Key("NAME").String(), ShouldEqual, "ini") - So(sec.Key("NAME").Validate(func(in string) string { - return in - }), ShouldEqual, "ini") - So(sec.Key("NAME").Comment, ShouldEqual, "; Package name") - So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "gopkg.in/ini.v1") - }) - - Convey("Get values in non-default section", func() { - sec := cfg.Section("author") - So(sec, ShouldNotBeNil) - So(sec.Key("NAME").String(), ShouldEqual, "Unknwon") - So(sec.Key("GITHUB").String(), ShouldEqual, "https://github.com/Unknwon") - - sec = cfg.Section("package") - So(sec, ShouldNotBeNil) - So(sec.Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - }) - - Convey("Get auto-increment key names", func() { - keys := cfg.Section("features").Keys() - for i, k := range keys { - So(k.Name(), ShouldEqual, fmt.Sprintf("#%d", i+1)) - } - }) - - Convey("Get parent-keys that are available to the child section", func() { - parentKeys := cfg.Section("package.sub").ParentKeys() - for _, k := range parentKeys { - So(k.Name(), ShouldEqual, "CLONE_URL") - } - }) - - Convey("Get overwrite value", func() { - So(cfg.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") - }) - - Convey("Get sections", func() { - sections := cfg.Sections() - for i, name := range []string{DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "comments", "string escapes", "advance"} { - So(sections[i].Name(), ShouldEqual, name) - } - }) - - Convey("Get parent section value", func() { - So(cfg.Section("package.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - So(cfg.Section("package.fake.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - }) - - Convey("Get multiple line value", func() { - So(cfg.Section("author").Key("BIO").String(), ShouldEqual, "Gopher.\nCoding addict.\nGood man.\n") - }) - - Convey("Get values with type", func() { - sec := cfg.Section("types") - v1, err := sec.Key("BOOL").Bool() - So(err, ShouldBeNil) - So(v1, ShouldBeTrue) - - v1, err = sec.Key("BOOL_FALSE").Bool() - So(err, ShouldBeNil) - So(v1, ShouldBeFalse) - - v2, err := sec.Key("FLOAT64").Float64() - So(err, ShouldBeNil) - So(v2, ShouldEqual, 1.25) - - v3, err := sec.Key("INT").Int() - So(err, ShouldBeNil) - So(v3, ShouldEqual, 10) - - v4, err := sec.Key("INT").Int64() - So(err, ShouldBeNil) - So(v4, ShouldEqual, 10) - - v5, err := sec.Key("UINT").Uint() - So(err, ShouldBeNil) - So(v5, ShouldEqual, 3) - - v6, err := sec.Key("UINT").Uint64() - So(err, ShouldBeNil) - So(v6, ShouldEqual, 3) - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - v7, err := sec.Key("TIME").Time() - So(err, ShouldBeNil) - So(v7.String(), ShouldEqual, t.String()) - - Convey("Must get values with type", func() { - So(sec.Key("STRING").MustString("404"), ShouldEqual, "str") - So(sec.Key("BOOL").MustBool(), ShouldBeTrue) - So(sec.Key("FLOAT64").MustFloat64(), ShouldEqual, 1.25) - So(sec.Key("INT").MustInt(), ShouldEqual, 10) - So(sec.Key("INT").MustInt64(), ShouldEqual, 10) - So(sec.Key("UINT").MustUint(), ShouldEqual, 3) - So(sec.Key("UINT").MustUint64(), ShouldEqual, 3) - So(sec.Key("TIME").MustTime().String(), ShouldEqual, t.String()) - - dur, err := time.ParseDuration("2h45m") - So(err, ShouldBeNil) - So(sec.Key("DURATION").MustDuration().Seconds(), ShouldEqual, dur.Seconds()) - - Convey("Must get values with default value", func() { - So(sec.Key("STRING_404").MustString("404"), ShouldEqual, "404") - So(sec.Key("BOOL_404").MustBool(true), ShouldBeTrue) - So(sec.Key("FLOAT64_404").MustFloat64(2.5), ShouldEqual, 2.5) - So(sec.Key("INT_404").MustInt(15), ShouldEqual, 15) - So(sec.Key("INT64_404").MustInt64(15), ShouldEqual, 15) - So(sec.Key("UINT_404").MustUint(6), ShouldEqual, 6) - So(sec.Key("UINT64_404").MustUint64(6), ShouldEqual, 6) - - t, err := time.Parse(time.RFC3339, "2014-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME_404").MustTime(t).String(), ShouldEqual, t.String()) - - So(sec.Key("DURATION_404").MustDuration(dur).Seconds(), ShouldEqual, dur.Seconds()) - - Convey("Must should set default as key value", func() { - So(sec.Key("STRING_404").String(), ShouldEqual, "404") - So(sec.Key("BOOL_404").String(), ShouldEqual, "true") - So(sec.Key("FLOAT64_404").String(), ShouldEqual, "2.5") - So(sec.Key("INT_404").String(), ShouldEqual, "15") - So(sec.Key("INT64_404").String(), ShouldEqual, "15") - So(sec.Key("UINT_404").String(), ShouldEqual, "6") - So(sec.Key("UINT64_404").String(), ShouldEqual, "6") - So(sec.Key("TIME_404").String(), ShouldEqual, "2014-01-01T20:17:05Z") - So(sec.Key("DURATION_404").String(), ShouldEqual, "2h45m0s") - }) - }) - }) - }) - - Convey("Get value with candidates", func() { - sec := cfg.Section("types") - So(sec.Key("STRING").In("", []string{"str", "arr", "types"}), ShouldEqual, "str") - So(sec.Key("FLOAT64").InFloat64(0, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) - So(sec.Key("INT").InInt(0, []int{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("INT").InInt64(0, []int64{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("UINT").InUint(0, []uint{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("UINT").InUint64(0, []uint64{3, 6, 9}), ShouldEqual, 3) - - zt, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") - So(err, ShouldBeNil) - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME").InTime(zt, []time.Time{t, time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) - - Convey("Get value with candidates and default value", func() { - So(sec.Key("STRING_404").In("str", []string{"str", "arr", "types"}), ShouldEqual, "str") - So(sec.Key("FLOAT64_404").InFloat64(1.25, []float64{1.25, 2.5, 3.75}), ShouldEqual, 1.25) - So(sec.Key("INT_404").InInt(10, []int{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("INT64_404").InInt64(10, []int64{10, 20, 30}), ShouldEqual, 10) - So(sec.Key("UINT_404").InUint(3, []uint{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("UINT_404").InUint64(3, []uint64{3, 6, 9}), ShouldEqual, 3) - So(sec.Key("TIME_404").InTime(t, []time.Time{time.Now(), time.Now(), time.Now().Add(1 * time.Second)}).String(), ShouldEqual, t.String()) - }) - }) - - Convey("Get values in range", func() { - sec := cfg.Section("types") - So(sec.Key("FLOAT64").RangeFloat64(0, 1, 2), ShouldEqual, 1.25) - So(sec.Key("INT").RangeInt(0, 10, 20), ShouldEqual, 10) - So(sec.Key("INT").RangeInt64(0, 10, 20), ShouldEqual, 10) - - minT, err := time.Parse(time.RFC3339, "0001-01-01T01:00:00Z") - So(err, ShouldBeNil) - midT, err := time.Parse(time.RFC3339, "2013-01-01T01:00:00Z") - So(err, ShouldBeNil) - maxT, err := time.Parse(time.RFC3339, "9999-01-01T01:00:00Z") - So(err, ShouldBeNil) - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - So(sec.Key("TIME").RangeTime(t, minT, maxT).String(), ShouldEqual, t.String()) - - Convey("Get value in range with default value", func() { - So(sec.Key("FLOAT64").RangeFloat64(5, 0, 1), ShouldEqual, 5) - So(sec.Key("INT").RangeInt(7, 0, 5), ShouldEqual, 7) - So(sec.Key("INT").RangeInt64(7, 0, 5), ShouldEqual, 7) - So(sec.Key("TIME").RangeTime(t, minT, midT).String(), ShouldEqual, t.String()) - }) - }) - - Convey("Get values into slice", func() { - sec := cfg.Section("array") - So(strings.Join(sec.Key("STRINGS").Strings(","), ","), ShouldEqual, "en,zh,de") - So(len(sec.Key("STRINGS_404").Strings(",")), ShouldEqual, 0) - - vals1 := sec.Key("FLOAT64S").Float64s(",") - float64sEqual(vals1, 1.1, 2.2, 3.3) - - vals2 := sec.Key("INTS").Ints(",") - intsEqual(vals2, 1, 2, 3) - - vals3 := sec.Key("INTS").Int64s(",") - int64sEqual(vals3, 1, 2, 3) - - vals4 := sec.Key("UINTS").Uints(",") - uintsEqual(vals4, 1, 2, 3) - - vals5 := sec.Key("UINTS").Uint64s(",") - uint64sEqual(vals5, 1, 2, 3) - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - vals6 := sec.Key("TIMES").Times(",") - timesEqual(vals6, t, t, t) - }) - - Convey("Test string slice escapes", func() { - sec := cfg.Section("string escapes") - So(sec.Key("key1").Strings(","), ShouldResemble, []string{"value1", "value2", "value3"}) - So(sec.Key("key2").Strings(","), ShouldResemble, []string{"value1, value2"}) - So(sec.Key("key3").Strings(","), ShouldResemble, []string{`val\ue1`, "value2"}) - So(sec.Key("key4").Strings(","), ShouldResemble, []string{`value1\`, `value\\2`}) - So(sec.Key("key5").Strings(",,"), ShouldResemble, []string{"value1,, value2"}) - So(sec.Key("key6").Strings(" "), ShouldResemble, []string{"aaa", "bbb and space", "ccc"}) - }) - - Convey("Get valid values into slice", func() { - sec := cfg.Section("array") - vals1 := sec.Key("FLOAT64S").ValidFloat64s(",") - float64sEqual(vals1, 1.1, 2.2, 3.3) - - vals2 := sec.Key("INTS").ValidInts(",") - intsEqual(vals2, 1, 2, 3) - - vals3 := sec.Key("INTS").ValidInt64s(",") - int64sEqual(vals3, 1, 2, 3) - - vals4 := sec.Key("UINTS").ValidUints(",") - uintsEqual(vals4, 1, 2, 3) - - vals5 := sec.Key("UINTS").ValidUint64s(",") - uint64sEqual(vals5, 1, 2, 3) - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - vals6 := sec.Key("TIMES").ValidTimes(",") - timesEqual(vals6, t, t, t) - }) - - Convey("Get values one type into slice of another type", func() { - sec := cfg.Section("array") - vals1 := sec.Key("STRINGS").ValidFloat64s(",") - So(vals1, ShouldBeEmpty) - - vals2 := sec.Key("STRINGS").ValidInts(",") - So(vals2, ShouldBeEmpty) - - vals3 := sec.Key("STRINGS").ValidInt64s(",") - So(vals3, ShouldBeEmpty) - - vals4 := sec.Key("STRINGS").ValidUints(",") - So(vals4, ShouldBeEmpty) - - vals5 := sec.Key("STRINGS").ValidUint64s(",") - So(vals5, ShouldBeEmpty) - - vals6 := sec.Key("STRINGS").ValidTimes(",") - So(vals6, ShouldBeEmpty) - }) - - Convey("Get valid values into slice without errors", func() { - sec := cfg.Section("array") - vals1, err := sec.Key("FLOAT64S").StrictFloat64s(",") - So(err, ShouldBeNil) - float64sEqual(vals1, 1.1, 2.2, 3.3) - - vals2, err := sec.Key("INTS").StrictInts(",") - So(err, ShouldBeNil) - intsEqual(vals2, 1, 2, 3) - - vals3, err := sec.Key("INTS").StrictInt64s(",") - So(err, ShouldBeNil) - int64sEqual(vals3, 1, 2, 3) - - vals4, err := sec.Key("UINTS").StrictUints(",") - So(err, ShouldBeNil) - uintsEqual(vals4, 1, 2, 3) - - vals5, err := sec.Key("UINTS").StrictUint64s(",") - So(err, ShouldBeNil) - uint64sEqual(vals5, 1, 2, 3) - - t, err := time.Parse(time.RFC3339, "2015-01-01T20:17:05Z") - So(err, ShouldBeNil) - vals6, err := sec.Key("TIMES").StrictTimes(",") - So(err, ShouldBeNil) - timesEqual(vals6, t, t, t) - }) - - Convey("Get invalid values into slice", func() { - sec := cfg.Section("array") - vals1, err := sec.Key("STRINGS").StrictFloat64s(",") - So(vals1, ShouldBeEmpty) - So(err, ShouldNotBeNil) - - vals2, err := sec.Key("STRINGS").StrictInts(",") - So(vals2, ShouldBeEmpty) - So(err, ShouldNotBeNil) - - vals3, err := sec.Key("STRINGS").StrictInt64s(",") - So(vals3, ShouldBeEmpty) - So(err, ShouldNotBeNil) - - vals4, err := sec.Key("STRINGS").StrictUints(",") - So(vals4, ShouldBeEmpty) - So(err, ShouldNotBeNil) - - vals5, err := sec.Key("STRINGS").StrictUint64s(",") - So(vals5, ShouldBeEmpty) - So(err, ShouldNotBeNil) - - vals6, err := sec.Key("STRINGS").StrictTimes(",") - So(vals6, ShouldBeEmpty) - So(err, ShouldNotBeNil) - }) - - Convey("Get key hash", func() { - cfg.Section("").KeysHash() - }) - - Convey("Set key value", func() { - k := cfg.Section("author").Key("NAME") - k.SetValue("无闻") - So(k.String(), ShouldEqual, "无闻") - }) - - Convey("Get key strings", func() { - So(strings.Join(cfg.Section("types").KeyStrings(), ","), ShouldEqual, "STRING,BOOL,BOOL_FALSE,FLOAT64,INT,TIME,DURATION,UINT") - }) - - Convey("Delete a key", func() { - cfg.Section("package.sub").DeleteKey("UNUSED_KEY") - _, err := cfg.Section("package.sub").GetKey("UNUSED_KEY") - So(err, ShouldNotBeNil) - }) - - Convey("Has Key (backwards compatible)", func() { - sec := cfg.Section("package.sub") - haskey1 := sec.Haskey("UNUSED_KEY") - haskey2 := sec.Haskey("CLONE_URL") - haskey3 := sec.Haskey("CLONE_URL_NO") - So(haskey1, ShouldBeTrue) - So(haskey2, ShouldBeTrue) - So(haskey3, ShouldBeFalse) - }) - - Convey("Has Key", func() { - sec := cfg.Section("package.sub") - haskey1 := sec.HasKey("UNUSED_KEY") - haskey2 := sec.HasKey("CLONE_URL") - haskey3 := sec.HasKey("CLONE_URL_NO") - So(haskey1, ShouldBeTrue) - So(haskey2, ShouldBeTrue) - So(haskey3, ShouldBeFalse) - }) - - Convey("Has Value", func() { - sec := cfg.Section("author") - hasvalue1 := sec.HasValue("Unknwon") - hasvalue2 := sec.HasValue("doc") - So(hasvalue1, ShouldBeTrue) - So(hasvalue2, ShouldBeFalse) - }) - }) - - Convey("Test getting and setting bad values", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Create new key with empty name", func() { - k, err := cfg.Section("").NewKey("", "") - So(err, ShouldNotBeNil) - So(k, ShouldBeNil) - }) - - Convey("Create new section with empty name", func() { - s, err := cfg.NewSection("") - So(err, ShouldNotBeNil) - So(s, ShouldBeNil) - }) - - Convey("Create new sections with empty name", func() { - So(cfg.NewSections(""), ShouldNotBeNil) - }) - - Convey("Get section that not exists", func() { - s, err := cfg.GetSection("404") - So(err, ShouldNotBeNil) - So(s, ShouldBeNil) - - s = cfg.Section("404") - So(s, ShouldNotBeNil) - }) - }) - - Convey("Test key hash clone", t, func() { - cfg, err := Load([]byte(strings.Replace("network=tcp,addr=127.0.0.1:6379,db=4,pool_size=100,idle_timeout=180", ",", "\n", -1))) - So(err, ShouldBeNil) - for _, v := range cfg.Section("").KeysHash() { - So(len(v), ShouldBeGreaterThan, 0) - } - }) - - Convey("Key has empty value", t, func() { - _conf := `key1= -key2= ; comment` - cfg, err := Load([]byte(_conf)) - So(err, ShouldBeNil) - So(cfg.Section("").Key("key1").Value(), ShouldBeEmpty) - }) -} - -const _CONF_GIT_CONFIG = ` -[remote "origin"] - url = https://github.com/Antergone/test1.git - url = https://github.com/Antergone/test2.git -` - -func Test_Key_Shadows(t *testing.T) { - Convey("Shadows keys", t, func() { - Convey("Disable shadows", func() { - cfg, err := Load([]byte(_CONF_GIT_CONFIG)) - So(err, ShouldBeNil) - So(cfg.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test2.git") - }) - - Convey("Enable shadows", func() { - cfg, err := ShadowLoad([]byte(_CONF_GIT_CONFIG)) - So(err, ShouldBeNil) - So(cfg.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test1.git") - So(strings.Join(cfg.Section(`remote "origin"`).Key("url").ValueWithShadows(), " "), ShouldEqual, - "https://github.com/Antergone/test1.git https://github.com/Antergone/test2.git") - - Convey("Save with shadows", func() { - var buf bytes.Buffer - _, err := cfg.WriteTo(&buf) - So(err, ShouldBeNil) - So(buf.String(), ShouldEqual, `[remote "origin"] -url = https://github.com/Antergone/test1.git -url = https://github.com/Antergone/test2.git - -`) - }) - }) - }) -} - -func newTestFile(block bool) *File { - c, _ := Load([]byte(_CONF_DATA)) - c.BlockMode = block - return c -} - -func Benchmark_Key_Value(b *testing.B) { - c := newTestFile(true) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").Value() - } -} - -func Benchmark_Key_Value_NonBlock(b *testing.B) { - c := newTestFile(false) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").Value() - } -} - -func Benchmark_Key_Value_ViaSection(b *testing.B) { - c := newTestFile(true) - sec := c.Section("") - for i := 0; i < b.N; i++ { - sec.Key("NAME").Value() - } -} - -func Benchmark_Key_Value_ViaSection_NonBlock(b *testing.B) { - c := newTestFile(false) - sec := c.Section("") - for i := 0; i < b.N; i++ { - sec.Key("NAME").Value() - } -} - -func Benchmark_Key_Value_Direct(b *testing.B) { - c := newTestFile(true) - key := c.Section("").Key("NAME") - for i := 0; i < b.N; i++ { - key.Value() - } -} - -func Benchmark_Key_Value_Direct_NonBlock(b *testing.B) { - c := newTestFile(false) - key := c.Section("").Key("NAME") - for i := 0; i < b.N; i++ { - key.Value() - } -} - -func Benchmark_Key_String(b *testing.B) { - c := newTestFile(true) - for i := 0; i < b.N; i++ { - _ = c.Section("").Key("NAME").String() - } -} - -func Benchmark_Key_String_NonBlock(b *testing.B) { - c := newTestFile(false) - for i := 0; i < b.N; i++ { - _ = c.Section("").Key("NAME").String() - } -} - -func Benchmark_Key_String_ViaSection(b *testing.B) { - c := newTestFile(true) - sec := c.Section("") - for i := 0; i < b.N; i++ { - _ = sec.Key("NAME").String() - } -} - -func Benchmark_Key_String_ViaSection_NonBlock(b *testing.B) { - c := newTestFile(false) - sec := c.Section("") - for i := 0; i < b.N; i++ { - _ = sec.Key("NAME").String() - } -} - -func Benchmark_Key_SetValue(b *testing.B) { - c := newTestFile(true) - for i := 0; i < b.N; i++ { - c.Section("").Key("NAME").SetValue("10") - } -} - -func Benchmark_Key_SetValue_VisSection(b *testing.B) { - c := newTestFile(true) - sec := c.Section("") - for i := 0; i < b.N; i++ { - sec.Key("NAME").SetValue("10") - } -} diff --git a/vendor/github.com/go-ini/ini/parser.go b/vendor/github.com/go-ini/ini/parser.go deleted file mode 100644 index 861e366e..00000000 --- a/vendor/github.com/go-ini/ini/parser.go +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright 2015 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bufio" - "bytes" - "fmt" - "io" - "strconv" - "strings" - "unicode" -) - -type tokenType int - -const ( - _TOKEN_INVALID tokenType = iota - _TOKEN_COMMENT - _TOKEN_SECTION - _TOKEN_KEY -) - -type parser struct { - buf *bufio.Reader - isEOF bool - count int - comment *bytes.Buffer -} - -func newParser(r io.Reader) *parser { - return &parser{ - buf: bufio.NewReader(r), - count: 1, - comment: &bytes.Buffer{}, - } -} - -// BOM handles header of UTF-8, UTF-16 LE and UTF-16 BE's BOM format. -// http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding -func (p *parser) BOM() error { - mask, err := p.buf.Peek(2) - if err != nil && err != io.EOF { - return err - } else if len(mask) < 2 { - return nil - } - - switch { - case mask[0] == 254 && mask[1] == 255: - fallthrough - case mask[0] == 255 && mask[1] == 254: - p.buf.Read(mask) - case mask[0] == 239 && mask[1] == 187: - mask, err := p.buf.Peek(3) - if err != nil && err != io.EOF { - return err - } else if len(mask) < 3 { - return nil - } - if mask[2] == 191 { - p.buf.Read(mask) - } - } - return nil -} - -func (p *parser) readUntil(delim byte) ([]byte, error) { - data, err := p.buf.ReadBytes(delim) - if err != nil { - if err == io.EOF { - p.isEOF = true - } else { - return nil, err - } - } - return data, nil -} - -func cleanComment(in []byte) ([]byte, bool) { - i := bytes.IndexAny(in, "#;") - if i == -1 { - return nil, false - } - return in[i:], true -} - -func readKeyName(in []byte) (string, int, error) { - line := string(in) - - // Check if key name surrounded by quotes. - var keyQuote string - if line[0] == '"' { - if len(line) > 6 && string(line[0:3]) == `"""` { - keyQuote = `"""` - } else { - keyQuote = `"` - } - } else if line[0] == '`' { - keyQuote = "`" - } - - // Get out key name - endIdx := -1 - if len(keyQuote) > 0 { - startIdx := len(keyQuote) - // FIXME: fail case -> """"""name"""=value - pos := strings.Index(line[startIdx:], keyQuote) - if pos == -1 { - return "", -1, fmt.Errorf("missing closing key quote: %s", line) - } - pos += startIdx - - // Find key-value delimiter - i := strings.IndexAny(line[pos+startIdx:], "=:") - if i < 0 { - return "", -1, ErrDelimiterNotFound{line} - } - endIdx = pos + i - return strings.TrimSpace(line[startIdx:pos]), endIdx + startIdx + 1, nil - } - - endIdx = strings.IndexAny(line, "=:") - if endIdx < 0 { - return "", -1, ErrDelimiterNotFound{line} - } - return strings.TrimSpace(line[0:endIdx]), endIdx + 1, nil -} - -func (p *parser) readMultilines(line, val, valQuote string) (string, error) { - for { - data, err := p.readUntil('\n') - if err != nil { - return "", err - } - next := string(data) - - pos := strings.LastIndex(next, valQuote) - if pos > -1 { - val += next[:pos] - - comment, has := cleanComment([]byte(next[pos:])) - if has { - p.comment.Write(bytes.TrimSpace(comment)) - } - break - } - val += next - if p.isEOF { - return "", fmt.Errorf("missing closing key quote from '%s' to '%s'", line, next) - } - } - return val, nil -} - -func (p *parser) readContinuationLines(val string) (string, error) { - for { - data, err := p.readUntil('\n') - if err != nil { - return "", err - } - next := strings.TrimSpace(string(data)) - - if len(next) == 0 { - break - } - val += next - if val[len(val)-1] != '\\' { - break - } - val = val[:len(val)-1] - } - return val, nil -} - -// hasSurroundedQuote check if and only if the first and last characters -// are quotes \" or \'. -// It returns false if any other parts also contain same kind of quotes. -func hasSurroundedQuote(in string, quote byte) bool { - return len(in) >= 2 && in[0] == quote && in[len(in)-1] == quote && - strings.IndexByte(in[1:], quote) == len(in)-2 -} - -func (p *parser) readValue(in []byte, ignoreContinuation, ignoreInlineComment, unescapeValueDoubleQuotes bool) (string, error) { - line := strings.TrimLeftFunc(string(in), unicode.IsSpace) - if len(line) == 0 { - return "", nil - } - - var valQuote string - if len(line) > 3 && string(line[0:3]) == `"""` { - valQuote = `"""` - } else if line[0] == '`' { - valQuote = "`" - } else if unescapeValueDoubleQuotes && line[0] == '"' { - valQuote = `"` - } - - if len(valQuote) > 0 { - startIdx := len(valQuote) - pos := strings.LastIndex(line[startIdx:], valQuote) - // Check for multi-line value - if pos == -1 { - return p.readMultilines(line, line[startIdx:], valQuote) - } - - if unescapeValueDoubleQuotes && valQuote == `"` { - return strings.Replace(line[startIdx:pos+startIdx], `\"`, `"`, -1), nil - } - return line[startIdx : pos+startIdx], nil - } - - // Won't be able to reach here if value only contains whitespace - line = strings.TrimSpace(line) - - // Check continuation lines when desired - if !ignoreContinuation && line[len(line)-1] == '\\' { - return p.readContinuationLines(line[:len(line)-1]) - } - - // Check if ignore inline comment - if !ignoreInlineComment { - i := strings.IndexAny(line, "#;") - if i > -1 { - p.comment.WriteString(line[i:]) - line = strings.TrimSpace(line[:i]) - } - } - - // Trim single and double quotes - if hasSurroundedQuote(line, '\'') || - hasSurroundedQuote(line, '"') { - line = line[1 : len(line)-1] - } - return line, nil -} - -// parse parses data through an io.Reader. -func (f *File) parse(reader io.Reader) (err error) { - p := newParser(reader) - if err = p.BOM(); err != nil { - return fmt.Errorf("BOM: %v", err) - } - - // Ignore error because default section name is never empty string. - section, _ := f.NewSection(DEFAULT_SECTION) - - var line []byte - var inUnparseableSection bool - for !p.isEOF { - line, err = p.readUntil('\n') - if err != nil { - return err - } - - line = bytes.TrimLeftFunc(line, unicode.IsSpace) - if len(line) == 0 { - continue - } - - // Comments - if line[0] == '#' || line[0] == ';' { - // Note: we do not care ending line break, - // it is needed for adding second line, - // so just clean it once at the end when set to value. - p.comment.Write(line) - continue - } - - // Section - if line[0] == '[' { - // Read to the next ']' (TODO: support quoted strings) - // TODO(unknwon): use LastIndexByte when stop supporting Go1.4 - closeIdx := bytes.LastIndex(line, []byte("]")) - if closeIdx == -1 { - return fmt.Errorf("unclosed section: %s", line) - } - - name := string(line[1:closeIdx]) - section, err = f.NewSection(name) - if err != nil { - return err - } - - comment, has := cleanComment(line[closeIdx+1:]) - if has { - p.comment.Write(comment) - } - - section.Comment = strings.TrimSpace(p.comment.String()) - - // Reset aotu-counter and comments - p.comment.Reset() - p.count = 1 - - inUnparseableSection = false - for i := range f.options.UnparseableSections { - if f.options.UnparseableSections[i] == name || - (f.options.Insensitive && strings.ToLower(f.options.UnparseableSections[i]) == strings.ToLower(name)) { - inUnparseableSection = true - continue - } - } - continue - } - - if inUnparseableSection { - section.isRawSection = true - section.rawBody += string(line) - continue - } - - kname, offset, err := readKeyName(line) - if err != nil { - // Treat as boolean key when desired, and whole line is key name. - if IsErrDelimiterNotFound(err) && f.options.AllowBooleanKeys { - kname, err := p.readValue(line, - f.options.IgnoreContinuation, - f.options.IgnoreInlineComment, - f.options.UnescapeValueDoubleQuotes) - if err != nil { - return err - } - key, err := section.NewBooleanKey(kname) - if err != nil { - return err - } - key.Comment = strings.TrimSpace(p.comment.String()) - p.comment.Reset() - continue - } - return err - } - - // Auto increment. - isAutoIncr := false - if kname == "-" { - isAutoIncr = true - kname = "#" + strconv.Itoa(p.count) - p.count++ - } - - value, err := p.readValue(line[offset:], - f.options.IgnoreContinuation, - f.options.IgnoreInlineComment, - f.options.UnescapeValueDoubleQuotes) - if err != nil { - return err - } - - key, err := section.NewKey(kname, value) - if err != nil { - return err - } - key.isAutoIncrement = isAutoIncr - key.Comment = strings.TrimSpace(p.comment.String()) - p.comment.Reset() - } - return nil -} diff --git a/vendor/github.com/go-ini/ini/parser_test.go b/vendor/github.com/go-ini/ini/parser_test.go deleted file mode 100644 index 05258195..00000000 --- a/vendor/github.com/go-ini/ini/parser_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2016 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "testing" - - . "github.com/smartystreets/goconvey/convey" -) - -func Test_BOM(t *testing.T) { - Convey("Test handling BOM", t, func() { - Convey("UTF-8-BOM", func() { - cfg, err := Load("testdata/UTF-8-BOM.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") - }) - - Convey("UTF-16-LE-BOM", func() { - cfg, err := Load("testdata/UTF-16-LE-BOM.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - }) - - Convey("UTF-16-BE-BOM", func() { - }) - }) -} diff --git a/vendor/github.com/go-ini/ini/section.go b/vendor/github.com/go-ini/ini/section.go deleted file mode 100644 index 94f7375e..00000000 --- a/vendor/github.com/go-ini/ini/section.go +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "errors" - "fmt" - "strings" -) - -// Section represents a config section. -type Section struct { - f *File - Comment string - name string - keys map[string]*Key - keyList []string - keysHash map[string]string - - isRawSection bool - rawBody string -} - -func newSection(f *File, name string) *Section { - return &Section{ - f: f, - name: name, - keys: make(map[string]*Key), - keyList: make([]string, 0, 10), - keysHash: make(map[string]string), - } -} - -// Name returns name of Section. -func (s *Section) Name() string { - return s.name -} - -// Body returns rawBody of Section if the section was marked as unparseable. -// It still follows the other rules of the INI format surrounding leading/trailing whitespace. -func (s *Section) Body() string { - return strings.TrimSpace(s.rawBody) -} - -// NewKey creates a new key to given section. -func (s *Section) NewKey(name, val string) (*Key, error) { - if len(name) == 0 { - return nil, errors.New("error creating new key: empty key name") - } else if s.f.options.Insensitive { - name = strings.ToLower(name) - } - - if s.f.BlockMode { - s.f.lock.Lock() - defer s.f.lock.Unlock() - } - - if inSlice(name, s.keyList) { - if s.f.options.AllowShadows { - if err := s.keys[name].addShadow(val); err != nil { - return nil, err - } - } else { - s.keys[name].value = val - } - return s.keys[name], nil - } - - s.keyList = append(s.keyList, name) - s.keys[name] = newKey(s, name, val) - s.keysHash[name] = val - return s.keys[name], nil -} - -// NewBooleanKey creates a new boolean type key to given section. -func (s *Section) NewBooleanKey(name string) (*Key, error) { - key, err := s.NewKey(name, "true") - if err != nil { - return nil, err - } - - key.isBooleanType = true - return key, nil -} - -// GetKey returns key in section by given name. -func (s *Section) GetKey(name string) (*Key, error) { - // FIXME: change to section level lock? - if s.f.BlockMode { - s.f.lock.RLock() - } - if s.f.options.Insensitive { - name = strings.ToLower(name) - } - key := s.keys[name] - if s.f.BlockMode { - s.f.lock.RUnlock() - } - - if key == nil { - // Check if it is a child-section. - sname := s.name - for { - if i := strings.LastIndex(sname, "."); i > -1 { - sname = sname[:i] - sec, err := s.f.GetSection(sname) - if err != nil { - continue - } - return sec.GetKey(name) - } else { - break - } - } - return nil, fmt.Errorf("error when getting key of section '%s': key '%s' not exists", s.name, name) - } - return key, nil -} - -// HasKey returns true if section contains a key with given name. -func (s *Section) HasKey(name string) bool { - key, _ := s.GetKey(name) - return key != nil -} - -// Haskey is a backwards-compatible name for HasKey. -func (s *Section) Haskey(name string) bool { - return s.HasKey(name) -} - -// HasValue returns true if section contains given raw value. -func (s *Section) HasValue(value string) bool { - if s.f.BlockMode { - s.f.lock.RLock() - defer s.f.lock.RUnlock() - } - - for _, k := range s.keys { - if value == k.value { - return true - } - } - return false -} - -// Key assumes named Key exists in section and returns a zero-value when not. -func (s *Section) Key(name string) *Key { - key, err := s.GetKey(name) - if err != nil { - // It's OK here because the only possible error is empty key name, - // but if it's empty, this piece of code won't be executed. - key, _ = s.NewKey(name, "") - return key - } - return key -} - -// Keys returns list of keys of section. -func (s *Section) Keys() []*Key { - keys := make([]*Key, len(s.keyList)) - for i := range s.keyList { - keys[i] = s.Key(s.keyList[i]) - } - return keys -} - -// ParentKeys returns list of keys of parent section. -func (s *Section) ParentKeys() []*Key { - var parentKeys []*Key - sname := s.name - for { - if i := strings.LastIndex(sname, "."); i > -1 { - sname = sname[:i] - sec, err := s.f.GetSection(sname) - if err != nil { - continue - } - parentKeys = append(parentKeys, sec.Keys()...) - } else { - break - } - - } - return parentKeys -} - -// KeyStrings returns list of key names of section. -func (s *Section) KeyStrings() []string { - list := make([]string, len(s.keyList)) - copy(list, s.keyList) - return list -} - -// KeysHash returns keys hash consisting of names and values. -func (s *Section) KeysHash() map[string]string { - if s.f.BlockMode { - s.f.lock.RLock() - defer s.f.lock.RUnlock() - } - - hash := map[string]string{} - for key, value := range s.keysHash { - hash[key] = value - } - return hash -} - -// DeleteKey deletes a key from section. -func (s *Section) DeleteKey(name string) { - if s.f.BlockMode { - s.f.lock.Lock() - defer s.f.lock.Unlock() - } - - for i, k := range s.keyList { - if k == name { - s.keyList = append(s.keyList[:i], s.keyList[i+1:]...) - delete(s.keys, name) - return - } - } -} - -// ChildSections returns a list of child sections of current section. -// For example, "[parent.child1]" and "[parent.child12]" are child sections -// of section "[parent]". -func (s *Section) ChildSections() []*Section { - prefix := s.name + "." - children := make([]*Section, 0, 3) - for _, name := range s.f.sectionList { - if strings.HasPrefix(name, prefix) { - children = append(children, s.f.sections[name]) - } - } - return children -} diff --git a/vendor/github.com/go-ini/ini/section_test.go b/vendor/github.com/go-ini/ini/section_test.go deleted file mode 100644 index f1ea671f..00000000 --- a/vendor/github.com/go-ini/ini/section_test.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "strings" - "testing" - - . "github.com/smartystreets/goconvey/convey" -) - -func Test_Section(t *testing.T) { - Convey("Test CRD sections", t, func() { - cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Get section strings", func() { - So(strings.Join(cfg.SectionStrings(), ","), ShouldEqual, "DEFAULT,author,package,package.sub,features,types,array,note,comments,string escapes,advance") - }) - - Convey("Delete a section", func() { - cfg.DeleteSection("") - So(cfg.SectionStrings()[0], ShouldNotEqual, DEFAULT_SECTION) - }) - - Convey("Create new sections", func() { - cfg.NewSections("test", "test2") - _, err := cfg.GetSection("test") - So(err, ShouldBeNil) - _, err = cfg.GetSection("test2") - So(err, ShouldBeNil) - }) - }) -} - -func Test_SectionRaw(t *testing.T) { - Convey("Test section raw string", t, func() { - cfg, err := LoadSources( - LoadOptions{ - Insensitive: true, - UnparseableSections: []string{"core_lesson", "comments"}, - }, - "testdata/aicc.ini") - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - Convey("Get section strings", func() { - So(strings.Join(cfg.SectionStrings(), ","), ShouldEqual, "DEFAULT,core,core_lesson,comments") - }) - - Convey("Validate non-raw section", func() { - val, err := cfg.Section("core").GetKey("lesson_status") - So(err, ShouldBeNil) - So(val.String(), ShouldEqual, "C") - }) - - Convey("Validate raw section", func() { - So(cfg.Section("core_lesson").Body(), ShouldEqual, `my lesson state data – 1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000 – end my lesson state data`) - }) - }) -} diff --git a/vendor/github.com/go-ini/ini/struct.go b/vendor/github.com/go-ini/ini/struct.go deleted file mode 100644 index e0bff67e..00000000 --- a/vendor/github.com/go-ini/ini/struct.go +++ /dev/null @@ -1,512 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bytes" - "errors" - "fmt" - "reflect" - "strings" - "time" - "unicode" -) - -// NameMapper represents a ini tag name mapper. -type NameMapper func(string) string - -// Built-in name getters. -var ( - // AllCapsUnderscore converts to format ALL_CAPS_UNDERSCORE. - AllCapsUnderscore NameMapper = func(raw string) string { - newstr := make([]rune, 0, len(raw)) - for i, chr := range raw { - if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { - if i > 0 { - newstr = append(newstr, '_') - } - } - newstr = append(newstr, unicode.ToUpper(chr)) - } - return string(newstr) - } - // TitleUnderscore converts to format title_underscore. - TitleUnderscore NameMapper = func(raw string) string { - newstr := make([]rune, 0, len(raw)) - for i, chr := range raw { - if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { - if i > 0 { - newstr = append(newstr, '_') - } - chr -= ('A' - 'a') - } - newstr = append(newstr, chr) - } - return string(newstr) - } -) - -func (s *Section) parseFieldName(raw, actual string) string { - if len(actual) > 0 { - return actual - } - if s.f.NameMapper != nil { - return s.f.NameMapper(raw) - } - return raw -} - -func parseDelim(actual string) string { - if len(actual) > 0 { - return actual - } - return "," -} - -var reflectTime = reflect.TypeOf(time.Now()).Kind() - -// setSliceWithProperType sets proper values to slice based on its type. -func setSliceWithProperType(key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error { - var strs []string - if allowShadow { - strs = key.StringsWithShadows(delim) - } else { - strs = key.Strings(delim) - } - - numVals := len(strs) - if numVals == 0 { - return nil - } - - var vals interface{} - var err error - - sliceOf := field.Type().Elem().Kind() - switch sliceOf { - case reflect.String: - vals = strs - case reflect.Int: - vals, err = key.parseInts(strs, true, false) - case reflect.Int64: - vals, err = key.parseInt64s(strs, true, false) - case reflect.Uint: - vals, err = key.parseUints(strs, true, false) - case reflect.Uint64: - vals, err = key.parseUint64s(strs, true, false) - case reflect.Float64: - vals, err = key.parseFloat64s(strs, true, false) - case reflectTime: - vals, err = key.parseTimesFormat(time.RFC3339, strs, true, false) - default: - return fmt.Errorf("unsupported type '[]%s'", sliceOf) - } - if err != nil && isStrict { - return err - } - - slice := reflect.MakeSlice(field.Type(), numVals, numVals) - for i := 0; i < numVals; i++ { - switch sliceOf { - case reflect.String: - slice.Index(i).Set(reflect.ValueOf(vals.([]string)[i])) - case reflect.Int: - slice.Index(i).Set(reflect.ValueOf(vals.([]int)[i])) - case reflect.Int64: - slice.Index(i).Set(reflect.ValueOf(vals.([]int64)[i])) - case reflect.Uint: - slice.Index(i).Set(reflect.ValueOf(vals.([]uint)[i])) - case reflect.Uint64: - slice.Index(i).Set(reflect.ValueOf(vals.([]uint64)[i])) - case reflect.Float64: - slice.Index(i).Set(reflect.ValueOf(vals.([]float64)[i])) - case reflectTime: - slice.Index(i).Set(reflect.ValueOf(vals.([]time.Time)[i])) - } - } - field.Set(slice) - return nil -} - -func wrapStrictError(err error, isStrict bool) error { - if isStrict { - return err - } - return nil -} - -// setWithProperType sets proper value to field based on its type, -// but it does not return error for failing parsing, -// because we want to use default value that is already assigned to strcut. -func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error { - switch t.Kind() { - case reflect.String: - if len(key.String()) == 0 { - return nil - } - field.SetString(key.String()) - case reflect.Bool: - boolVal, err := key.Bool() - if err != nil { - return wrapStrictError(err, isStrict) - } - field.SetBool(boolVal) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - durationVal, err := key.Duration() - // Skip zero value - if err == nil && int(durationVal) > 0 { - field.Set(reflect.ValueOf(durationVal)) - return nil - } - - intVal, err := key.Int64() - if err != nil { - return wrapStrictError(err, isStrict) - } - field.SetInt(intVal) - // byte is an alias for uint8, so supporting uint8 breaks support for byte - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - durationVal, err := key.Duration() - // Skip zero value - if err == nil && int(durationVal) > 0 { - field.Set(reflect.ValueOf(durationVal)) - return nil - } - - uintVal, err := key.Uint64() - if err != nil { - return wrapStrictError(err, isStrict) - } - field.SetUint(uintVal) - - case reflect.Float32, reflect.Float64: - floatVal, err := key.Float64() - if err != nil { - return wrapStrictError(err, isStrict) - } - field.SetFloat(floatVal) - case reflectTime: - timeVal, err := key.Time() - if err != nil { - return wrapStrictError(err, isStrict) - } - field.Set(reflect.ValueOf(timeVal)) - case reflect.Slice: - return setSliceWithProperType(key, field, delim, allowShadow, isStrict) - default: - return fmt.Errorf("unsupported type '%s'", t) - } - return nil -} - -func parseTagOptions(tag string) (rawName string, omitEmpty bool, allowShadow bool) { - opts := strings.SplitN(tag, ",", 3) - rawName = opts[0] - if len(opts) > 1 { - omitEmpty = opts[1] == "omitempty" - } - if len(opts) > 2 { - allowShadow = opts[2] == "allowshadow" - } - return rawName, omitEmpty, allowShadow -} - -func (s *Section) mapTo(val reflect.Value, isStrict bool) error { - if val.Kind() == reflect.Ptr { - val = val.Elem() - } - typ := val.Type() - - for i := 0; i < typ.NumField(); i++ { - field := val.Field(i) - tpField := typ.Field(i) - - tag := tpField.Tag.Get("ini") - if tag == "-" { - continue - } - - rawName, _, allowShadow := parseTagOptions(tag) - fieldName := s.parseFieldName(tpField.Name, rawName) - if len(fieldName) == 0 || !field.CanSet() { - continue - } - - isAnonymous := tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous - isStruct := tpField.Type.Kind() == reflect.Struct - if isAnonymous { - field.Set(reflect.New(tpField.Type.Elem())) - } - - if isAnonymous || isStruct { - if sec, err := s.f.GetSection(fieldName); err == nil { - if err = sec.mapTo(field, isStrict); err != nil { - return fmt.Errorf("error mapping field(%s): %v", fieldName, err) - } - continue - } - } - - if key, err := s.GetKey(fieldName); err == nil { - delim := parseDelim(tpField.Tag.Get("delim")) - if err = setWithProperType(tpField.Type, key, field, delim, allowShadow, isStrict); err != nil { - return fmt.Errorf("error mapping field(%s): %v", fieldName, err) - } - } - } - return nil -} - -// MapTo maps section to given struct. -func (s *Section) MapTo(v interface{}) error { - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - val = val.Elem() - } else { - return errors.New("cannot map to non-pointer struct") - } - - return s.mapTo(val, false) -} - -// MapTo maps section to given struct in strict mode, -// which returns all possible error including value parsing error. -func (s *Section) StrictMapTo(v interface{}) error { - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - val = val.Elem() - } else { - return errors.New("cannot map to non-pointer struct") - } - - return s.mapTo(val, true) -} - -// MapTo maps file to given struct. -func (f *File) MapTo(v interface{}) error { - return f.Section("").MapTo(v) -} - -// MapTo maps file to given struct in strict mode, -// which returns all possible error including value parsing error. -func (f *File) StrictMapTo(v interface{}) error { - return f.Section("").StrictMapTo(v) -} - -// MapTo maps data sources to given struct with name mapper. -func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { - cfg, err := Load(source, others...) - if err != nil { - return err - } - cfg.NameMapper = mapper - return cfg.MapTo(v) -} - -// StrictMapToWithMapper maps data sources to given struct with name mapper in strict mode, -// which returns all possible error including value parsing error. -func StrictMapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { - cfg, err := Load(source, others...) - if err != nil { - return err - } - cfg.NameMapper = mapper - return cfg.StrictMapTo(v) -} - -// MapTo maps data sources to given struct. -func MapTo(v, source interface{}, others ...interface{}) error { - return MapToWithMapper(v, nil, source, others...) -} - -// StrictMapTo maps data sources to given struct in strict mode, -// which returns all possible error including value parsing error. -func StrictMapTo(v, source interface{}, others ...interface{}) error { - return StrictMapToWithMapper(v, nil, source, others...) -} - -// reflectSliceWithProperType does the opposite thing as setSliceWithProperType. -func reflectSliceWithProperType(key *Key, field reflect.Value, delim string) error { - slice := field.Slice(0, field.Len()) - if field.Len() == 0 { - return nil - } - - var buf bytes.Buffer - sliceOf := field.Type().Elem().Kind() - for i := 0; i < field.Len(); i++ { - switch sliceOf { - case reflect.String: - buf.WriteString(slice.Index(i).String()) - case reflect.Int, reflect.Int64: - buf.WriteString(fmt.Sprint(slice.Index(i).Int())) - case reflect.Uint, reflect.Uint64: - buf.WriteString(fmt.Sprint(slice.Index(i).Uint())) - case reflect.Float64: - buf.WriteString(fmt.Sprint(slice.Index(i).Float())) - case reflectTime: - buf.WriteString(slice.Index(i).Interface().(time.Time).Format(time.RFC3339)) - default: - return fmt.Errorf("unsupported type '[]%s'", sliceOf) - } - buf.WriteString(delim) - } - key.SetValue(buf.String()[:buf.Len()-1]) - return nil -} - -// reflectWithProperType does the opposite thing as setWithProperType. -func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error { - switch t.Kind() { - case reflect.String: - key.SetValue(field.String()) - case reflect.Bool: - key.SetValue(fmt.Sprint(field.Bool())) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - key.SetValue(fmt.Sprint(field.Int())) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - key.SetValue(fmt.Sprint(field.Uint())) - case reflect.Float32, reflect.Float64: - key.SetValue(fmt.Sprint(field.Float())) - case reflectTime: - key.SetValue(fmt.Sprint(field.Interface().(time.Time).Format(time.RFC3339))) - case reflect.Slice: - return reflectSliceWithProperType(key, field, delim) - default: - return fmt.Errorf("unsupported type '%s'", t) - } - return nil -} - -// CR: copied from encoding/json/encode.go with modifications of time.Time support. -// TODO: add more test coverage. -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - case reflectTime: - t, ok := v.Interface().(time.Time) - return ok && t.IsZero() - } - return false -} - -func (s *Section) reflectFrom(val reflect.Value) error { - if val.Kind() == reflect.Ptr { - val = val.Elem() - } - typ := val.Type() - - for i := 0; i < typ.NumField(); i++ { - field := val.Field(i) - tpField := typ.Field(i) - - tag := tpField.Tag.Get("ini") - if tag == "-" { - continue - } - - opts := strings.SplitN(tag, ",", 2) - if len(opts) == 2 && opts[1] == "omitempty" && isEmptyValue(field) { - continue - } - - fieldName := s.parseFieldName(tpField.Name, opts[0]) - if len(fieldName) == 0 || !field.CanSet() { - continue - } - - if (tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous) || - (tpField.Type.Kind() == reflect.Struct && tpField.Type.Name() != "Time") { - // Note: The only error here is section doesn't exist. - sec, err := s.f.GetSection(fieldName) - if err != nil { - // Note: fieldName can never be empty here, ignore error. - sec, _ = s.f.NewSection(fieldName) - } - - // Add comment from comment tag - if len(sec.Comment) == 0 { - sec.Comment = tpField.Tag.Get("comment") - } - - if err = sec.reflectFrom(field); err != nil { - return fmt.Errorf("error reflecting field (%s): %v", fieldName, err) - } - continue - } - - // Note: Same reason as secion. - key, err := s.GetKey(fieldName) - if err != nil { - key, _ = s.NewKey(fieldName, "") - } - - // Add comment from comment tag - if len(key.Comment) == 0 { - key.Comment = tpField.Tag.Get("comment") - } - - if err = reflectWithProperType(tpField.Type, key, field, parseDelim(tpField.Tag.Get("delim"))); err != nil { - return fmt.Errorf("error reflecting field (%s): %v", fieldName, err) - } - - } - return nil -} - -// ReflectFrom reflects secion from given struct. -func (s *Section) ReflectFrom(v interface{}) error { - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - val = val.Elem() - } else { - return errors.New("cannot reflect from non-pointer struct") - } - - return s.reflectFrom(val) -} - -// ReflectFrom reflects file from given struct. -func (f *File) ReflectFrom(v interface{}) error { - return f.Section("").ReflectFrom(v) -} - -// ReflectFrom reflects data sources from given struct with name mapper. -func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error { - cfg.NameMapper = mapper - return cfg.ReflectFrom(v) -} - -// ReflectFrom reflects data sources from given struct. -func ReflectFrom(cfg *File, v interface{}) error { - return ReflectFromWithMapper(cfg, v, nil) -} diff --git a/vendor/github.com/go-ini/ini/struct_test.go b/vendor/github.com/go-ini/ini/struct_test.go deleted file mode 100644 index 86bb9de1..00000000 --- a/vendor/github.com/go-ini/ini/struct_test.go +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright 2014 Unknwon -// -// Licensed under the Apache License, Version 2.0 (the "License"): you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package ini - -import ( - "bytes" - "fmt" - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" -) - -type testNested struct { - Cities []string `delim:"|"` - Visits []time.Time - Years []int - Numbers []int64 - Ages []uint - Populations []uint64 - Coordinates []float64 - Note string - Unused int `ini:"-"` -} - -type testEmbeded struct { - GPA float64 -} - -type testStruct struct { - Name string `ini:"NAME"` - Age int - Male bool - Money float64 - Born time.Time - Time time.Duration `ini:"Duration"` - Others testNested - *testEmbeded `ini:"grade"` - Unused int `ini:"-"` - Unsigned uint - Omitted bool `ini:"omitthis,omitempty"` - Shadows []string `ini:",,allowshadow"` - ShadowInts []int `ini:"Shadows,,allowshadow"` -} - -const _CONF_DATA_STRUCT = ` -NAME = Unknwon -Age = 21 -Male = true -Money = 1.25 -Born = 1993-10-07T20:17:05Z -Duration = 2h45m -Unsigned = 3 -omitthis = true -Shadows = 1, 2 -Shadows = 3, 4 - -[Others] -Cities = HangZhou|Boston -Visits = 1993-10-07T20:17:05Z, 1993-10-07T20:17:05Z -Years = 1993,1994 -Numbers = 10010,10086 -Ages = 18,19 -Populations = 12345678,98765432 -Coordinates = 192.168,10.11 -Note = Hello world! - -[grade] -GPA = 2.8 - -[foo.bar] -Here = there -When = then -` - -type unsupport struct { - Byte byte -} - -type unsupport2 struct { - Others struct { - Cities byte - } -} - -type unsupport3 struct { - Cities byte -} - -type unsupport4 struct { - *unsupport3 `ini:"Others"` -} - -type defaultValue struct { - Name string - Age int - Male bool - Money float64 - Born time.Time - Cities []string -} - -type fooBar struct { - Here, When string -} - -const _INVALID_DATA_CONF_STRUCT = ` -Name = -Age = age -Male = 123 -Money = money -Born = nil -Cities = -` - -func Test_Struct(t *testing.T) { - Convey("Map to struct", t, func() { - Convey("Map file to struct", func() { - ts := new(testStruct) - So(MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil) - - So(ts.Name, ShouldEqual, "Unknwon") - So(ts.Age, ShouldEqual, 21) - So(ts.Male, ShouldBeTrue) - So(ts.Money, ShouldEqual, 1.25) - So(ts.Unsigned, ShouldEqual, 3) - - t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") - So(err, ShouldBeNil) - So(ts.Born.String(), ShouldEqual, t.String()) - - dur, err := time.ParseDuration("2h45m") - So(err, ShouldBeNil) - So(ts.Time.Seconds(), ShouldEqual, dur.Seconds()) - - So(strings.Join(ts.Others.Cities, ","), ShouldEqual, "HangZhou,Boston") - So(ts.Others.Visits[0].String(), ShouldEqual, t.String()) - So(fmt.Sprint(ts.Others.Years), ShouldEqual, "[1993 1994]") - So(fmt.Sprint(ts.Others.Numbers), ShouldEqual, "[10010 10086]") - So(fmt.Sprint(ts.Others.Ages), ShouldEqual, "[18 19]") - So(fmt.Sprint(ts.Others.Populations), ShouldEqual, "[12345678 98765432]") - So(fmt.Sprint(ts.Others.Coordinates), ShouldEqual, "[192.168 10.11]") - So(ts.Others.Note, ShouldEqual, "Hello world!") - So(ts.testEmbeded.GPA, ShouldEqual, 2.8) - }) - - Convey("Map section to struct", func() { - foobar := new(fooBar) - f, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - - So(f.Section("foo.bar").MapTo(foobar), ShouldBeNil) - So(foobar.Here, ShouldEqual, "there") - So(foobar.When, ShouldEqual, "then") - }) - - Convey("Map to non-pointer struct", func() { - cfg, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - So(cfg.MapTo(testStruct{}), ShouldNotBeNil) - }) - - Convey("Map to unsupported type", func() { - cfg, err := Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.NameMapper = func(raw string) string { - if raw == "Byte" { - return "NAME" - } - return raw - } - So(cfg.MapTo(&unsupport{}), ShouldNotBeNil) - So(cfg.MapTo(&unsupport2{}), ShouldNotBeNil) - So(cfg.MapTo(&unsupport4{}), ShouldNotBeNil) - }) - - Convey("Map to omitempty field", func() { - ts := new(testStruct) - So(MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil) - - So(ts.Omitted, ShouldEqual, true) - }) - - Convey("Map with shadows", func() { - cfg, err := LoadSources(LoadOptions{AllowShadows: true}, []byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - ts := new(testStruct) - So(cfg.MapTo(ts), ShouldBeNil) - - So(strings.Join(ts.Shadows, " "), ShouldEqual, "1 2 3 4") - So(fmt.Sprintf("%v", ts.ShadowInts), ShouldEqual, "[1 2 3 4]") - }) - - Convey("Map from invalid data source", func() { - So(MapTo(&testStruct{}, "hi"), ShouldNotBeNil) - }) - - Convey("Map to wrong types and gain default values", func() { - cfg, err := Load([]byte(_INVALID_DATA_CONF_STRUCT)) - So(err, ShouldBeNil) - - t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") - So(err, ShouldBeNil) - dv := &defaultValue{"Joe", 10, true, 1.25, t, []string{"HangZhou", "Boston"}} - So(cfg.MapTo(dv), ShouldBeNil) - So(dv.Name, ShouldEqual, "Joe") - So(dv.Age, ShouldEqual, 10) - So(dv.Male, ShouldBeTrue) - So(dv.Money, ShouldEqual, 1.25) - So(dv.Born.String(), ShouldEqual, t.String()) - So(strings.Join(dv.Cities, ","), ShouldEqual, "HangZhou,Boston") - }) - }) - - Convey("Map to struct in strict mode", t, func() { - cfg, err := Load([]byte(` -name=bruce -age=a30`)) - So(err, ShouldBeNil) - - type Strict struct { - Name string `ini:"name"` - Age int `ini:"age"` - } - s := new(Strict) - - So(cfg.Section("").StrictMapTo(s), ShouldNotBeNil) - }) - - Convey("Map slice in strict mode", t, func() { - cfg, err := Load([]byte(` -names=alice, bruce`)) - So(err, ShouldBeNil) - - type Strict struct { - Names []string `ini:"names"` - } - s := new(Strict) - - So(cfg.Section("").StrictMapTo(s), ShouldBeNil) - So(fmt.Sprint(s.Names), ShouldEqual, "[alice bruce]") - }) - - Convey("Reflect from struct", t, func() { - type Embeded struct { - Dates []time.Time `delim:"|" comment:"Time data"` - Places []string - Years []int - Numbers []int64 - Ages []uint - Populations []uint64 - Coordinates []float64 - None []int - } - type Author struct { - Name string `ini:"NAME"` - Male bool - Age int `comment:"Author's age"` - Height uint - GPA float64 - Date time.Time - NeverMind string `ini:"-"` - *Embeded `ini:"infos" comment:"Embeded section"` - } - - t, err := time.Parse(time.RFC3339, "1993-10-07T20:17:05Z") - So(err, ShouldBeNil) - a := &Author{"Unknwon", true, 21, 100, 2.8, t, "", - &Embeded{ - []time.Time{t, t}, - []string{"HangZhou", "Boston"}, - []int{1993, 1994}, - []int64{10010, 10086}, - []uint{18, 19}, - []uint64{12345678, 98765432}, - []float64{192.168, 10.11}, - []int{}, - }} - cfg := Empty() - So(ReflectFrom(cfg, a), ShouldBeNil) - - var buf bytes.Buffer - _, err = cfg.WriteTo(&buf) - So(err, ShouldBeNil) - So(buf.String(), ShouldEqual, `NAME = Unknwon -Male = true -; Author's age -Age = 21 -Height = 100 -GPA = 2.8 -Date = 1993-10-07T20:17:05Z - -; Embeded section -[infos] -; Time data -Dates = 1993-10-07T20:17:05Z|1993-10-07T20:17:05Z -Places = HangZhou,Boston -Years = 1993,1994 -Numbers = 10010,10086 -Ages = 18,19 -Populations = 12345678,98765432 -Coordinates = 192.168,10.11 -None = - -`) - - Convey("Reflect from non-point struct", func() { - So(ReflectFrom(cfg, Author{}), ShouldNotBeNil) - }) - - Convey("Reflect from struct with omitempty", func() { - cfg := Empty() - type SpecialStruct struct { - FirstName string `ini:"first_name"` - LastName string `ini:"last_name"` - JustOmitMe string `ini:"omitempty"` - LastLogin time.Time `ini:"last_login,omitempty"` - LastLogin2 time.Time `ini:",omitempty"` - NotEmpty int `ini:"omitempty"` - } - - So(ReflectFrom(cfg, &SpecialStruct{FirstName: "John", LastName: "Doe", NotEmpty: 9}), ShouldBeNil) - - var buf bytes.Buffer - _, err = cfg.WriteTo(&buf) - So(buf.String(), ShouldEqual, `first_name = John -last_name = Doe -omitempty = 9 - -`) - }) - }) -} - -type testMapper struct { - PackageName string -} - -func Test_NameGetter(t *testing.T) { - Convey("Test name mappers", t, func() { - So(MapToWithMapper(&testMapper{}, TitleUnderscore, []byte("packag_name=ini")), ShouldBeNil) - - cfg, err := Load([]byte("PACKAGE_NAME=ini")) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.NameMapper = AllCapsUnderscore - tg := new(testMapper) - So(cfg.MapTo(tg), ShouldBeNil) - So(tg.PackageName, ShouldEqual, "ini") - }) -} diff --git a/vendor/github.com/go-kit/kit/.gitignore b/vendor/github.com/go-kit/kit/.gitignore deleted file mode 100644 index 6062401c..00000000 --- a/vendor/github.com/go-kit/kit/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -examples/addsvc/addsvc -examples/addsvc/client/client -examples/apigateway/apigateway -examples/profilesvc/profilesvc -examples/stringsvc1/stringsvc1 -examples/stringsvc2/stringsvc2 -examples/stringsvc3/stringsvc3 -*.coverprofile - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test -_old* - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -# https://github.com/github/gitignore/blob/master/Global/Vim.gitignore -# swap -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -# session -Session.vim -# temporary -.netrwhist -*~ -# auto-generated tag files -tags - diff --git a/vendor/github.com/go-kit/kit/.travis.yml b/vendor/github.com/go-kit/kit/.travis.yml deleted file mode 100644 index 31624b2b..00000000 --- a/vendor/github.com/go-kit/kit/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go - -env: - - COVERALLS_TOKEN=MYSkSqcsWXd6DmP6TnSeiDhtvuL4u6ndp - -before_install: - - go get github.com/mattn/goveralls - - go get github.com/modocache/gover - -script: - - go test -race -v ./... - - ./coveralls.bash - -go: - - 1.9.x - - tip diff --git a/vendor/github.com/go-kit/kit/CONTRIBUTING.md b/vendor/github.com/go-kit/kit/CONTRIBUTING.md deleted file mode 100644 index c0751f85..00000000 --- a/vendor/github.com/go-kit/kit/CONTRIBUTING.md +++ /dev/null @@ -1,18 +0,0 @@ -# Contributing - -First, thank you for contributing! We love and encourage pull requests from everyone. - -Before submitting major changes, here are a few guidelines to follow: - -1. Check the [open issues][issues] and [pull requests][prs] for existing discussions. -1. Open an [issue][issues] first, to discuss a new feature or enhancement. -1. Write tests, and make sure the test suite passes locally and on CI. -1. Open a pull request, and reference the relevant issue(s). -1. After receiving feedback, [squash your commits][squash] and add a [great commit message][message]. -1. Have fun! - -[issues]: https://github.com/go-kit/kit/issues -[prs]: https://github.com/go-kit/kit/pulls -[squash]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html -[message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html - diff --git a/vendor/github.com/go-kit/kit/LICENSE b/vendor/github.com/go-kit/kit/LICENSE deleted file mode 100644 index 9d83342a..00000000 --- a/vendor/github.com/go-kit/kit/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Peter Bourgon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/go-kit/kit/README.md b/vendor/github.com/go-kit/kit/README.md deleted file mode 100644 index 2d9a2b4d..00000000 --- a/vendor/github.com/go-kit/kit/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# Go kit [![Circle CI](https://circleci.com/gh/go-kit/kit.svg?style=shield)](https://circleci.com/gh/go-kit/kit) [![Travis CI](https://travis-ci.org/go-kit/kit.svg?branch=master)](https://travis-ci.org/go-kit/kit) [![GoDoc](https://godoc.org/github.com/go-kit/kit?status.svg)](https://godoc.org/github.com/go-kit/kit) [![Coverage Status](https://coveralls.io/repos/go-kit/kit/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-kit/kit?branch=master) [![Go Report Card](https://goreportcard.com/badge/go-kit/kit)](https://goreportcard.com/report/go-kit/kit) [![Sourcegraph](https://sourcegraph.com/github.com/go-kit/kit/-/badge.svg)](https://sourcegraph.com/github.com/go-kit/kit?badge) - -**Go kit** is a **programming toolkit** for building microservices -(or elegant monoliths) in Go. We solve common problems in distributed -systems and application architecture so you can focus on delivering -business value. - -- Website: [gokit.io](https://gokit.io) -- Mailing list: [go-kit](https://groups.google.com/forum/#!forum/go-kit) -- Slack: [gophers.slack.com](https://gophers.slack.com) **#go-kit** ([invite](https://gophersinvite.herokuapp.com/)) - -## Motivation - -Go has emerged as the language of the server, but it remains underrepresented -in so-called "modern enterprise" companies like Facebook, Twitter, Netflix, and -SoundCloud. Many of these organizations have turned to JVM-based stacks for -their business logic, owing in large part to libraries and ecosystems that -directly support their microservice architectures. - -To reach its next level of success, Go needs more than simple primitives and -idioms. It needs a comprehensive toolkit, for coherent distributed programming -in the large. Go kit is a set of packages and best practices, which provide a -comprehensive, robust, and trustable way of building microservices for -organizations of any size. - -For more details, see - [the website](https://gokit.io), - [the motivating blog post](http://peter.bourgon.org/go-kit/) and - [the video of the talk](https://www.youtube.com/watch?v=iFR_7AKkJFU). -See also the - [Go kit talk at GopherCon 2015](https://www.youtube.com/watch?v=1AjaZi4QuGo). - -## Goals - -- Operate in a heterogeneous SOA — expect to interact with mostly non-Go-kit services -- RPC as the primary messaging pattern -- Pluggable serialization and transport — not just JSON over HTTP -- Operate within existing infrastructures — no mandates for specific tools or technologies - -## Non-goals - -- Supporting messaging patterns other than RPC (for now) — e.g. MPI, pub/sub, CQRS, etc. -- Re-implementing functionality that can be provided by adapting existing software -- Having opinions on operational concerns: deployment, configuration, process supervision, orchestration, etc. - -## Contributing - -Please see [CONTRIBUTING.md](/CONTRIBUTING.md). -Thank you, [contributors](https://github.com/go-kit/kit/graphs/contributors)! - -## Dependency management - -Go kit is a library, designed to be imported into a binary package. Vendoring -is currently the best way for binary package authors to ensure reliable, -reproducible builds. Therefore, we strongly recommend our users use vendoring -for all of their dependencies, including Go kit. To avoid compatibility and -availability issues, Go kit doesn't vendor its own dependencies, and -doesn't recommend use of third-party import proxies. - -There are several tools which make vendoring easier, including - [dep](https://github.com/golang/dep), - [gb](http://getgb.io), - [glide](https://github.com/Masterminds/glide), - [gvt](https://github.com/FiloSottile/gvt), and - [govendor](https://github.com/kardianos/govendor). -In addition, Go kit uses a variety of continuous integration providers - to find and fix compatibility problems as soon as they occur. - -## Related projects - -Projects with a ★ have had particular influence on Go kit's design (or vice-versa). - -### Service frameworks - -- [gizmo](https://github.com/nytimes/gizmo), a microservice toolkit from The New York Times ★ -- [go-micro](https://github.com/myodc/go-micro), a microservices client/server library ★ -- [gotalk](https://github.com/rsms/gotalk), async peer communication protocol & library -- [Kite](https://github.com/koding/kite), a micro-service framework -- [gocircuit](https://github.com/gocircuit/circuit), dynamic cloud orchestration - -### Individual components - -- [afex/hystrix-go](https://github.com/afex/hystrix-go), client-side latency and fault tolerance library -- [armon/go-metrics](https://github.com/armon/go-metrics), library for exporting performance and runtime metrics to external metrics systems -- [codahale/lunk](https://github.com/codahale/lunk), structured logging in the style of Google's Dapper or Twitter's Zipkin -- [eapache/go-resiliency](https://github.com/eapache/go-resiliency), resiliency patterns -- [sasbury/logging](https://github.com/sasbury/logging), a tagged style of logging -- [grpc/grpc-go](https://github.com/grpc/grpc-go), HTTP/2 based RPC -- [inconshreveable/log15](https://github.com/inconshreveable/log15), simple, powerful logging for Go ★ -- [mailgun/vulcand](https://github.com/vulcand/vulcand), programmatic load balancer backed by etcd -- [mattheath/phosphor](https://github.com/mondough/phosphor), distributed system tracing -- [pivotal-golang/lager](https://github.com/pivotal-golang/lager), an opinionated logging library -- [rubyist/circuitbreaker](https://github.com/rubyist/circuitbreaker), circuit breaker library -- [Sirupsen/logrus](https://github.com/Sirupsen/logrus), structured, pluggable logging for Go ★ -- [sourcegraph/appdash](https://github.com/sourcegraph/appdash), application tracing system based on Google's Dapper -- [spacemonkeygo/monitor](https://github.com/spacemonkeygo/monitor), data collection, monitoring, instrumentation, and Zipkin client library -- [streadway/handy](https://github.com/streadway/handy), net/http handler filters -- [vitess/rpcplus](https://godoc.org/github.com/youtube/vitess/go/rpcplus), package rpc + context.Context -- [gdamore/mangos](https://github.com/gdamore/mangos), nanomsg implementation in pure Go - -### Web frameworks - -- [Gorilla](http://www.gorillatoolkit.org) -- [Gin](https://gin-gonic.github.io/gin/) -- [Negroni](https://github.com/codegangsta/negroni) -- [Goji](https://github.com/zenazn/goji) -- [Martini](https://github.com/go-martini/martini) -- [Beego](http://beego.me/) -- [Revel](https://revel.github.io/) (considered [harmful](https://github.com/go-kit/kit/issues/350)) - -## Additional reading - -- [Architecting for the Cloud](http://fr.slideshare.net/stonse/architecting-for-the-cloud-using-netflixoss-codemash-workshop-29852233) — Netflix -- [Dapper, a Large-Scale Distributed Systems Tracing Infrastructure](http://research.google.com/pubs/pub36356.html) — Google -- [Your Server as a Function](http://monkey.org/~marius/funsrv.pdf) (PDF) — Twitter - ---- - -Development supported by [DigitalOcean](https://digitalocean.com). diff --git a/vendor/github.com/go-kit/kit/ROADMAP.md b/vendor/github.com/go-kit/kit/ROADMAP.md deleted file mode 100644 index 5c462aa2..00000000 --- a/vendor/github.com/go-kit/kit/ROADMAP.md +++ /dev/null @@ -1,17 +0,0 @@ -# Roadmap - -This is a coarse-grained roadmap of Go kit development direction in the short -to mid-term future. It will be kept reasonably up-to-date by the project -maintainers. Suggest new ideas, enhancements, and features using the standard -[issues](https://github.com/go-kit/kit/issues) model. - -## Prioritized - -1. kitgen code generation (#308, #70) -1. package pubsub (#298, #295) - -## Unprioritized - -- package log/levels refactor (#250, #269, #252) -- package auth/jwt (#255) - diff --git a/vendor/github.com/go-kit/kit/circle.yml b/vendor/github.com/go-kit/kit/circle.yml deleted file mode 100644 index 35ace2ce..00000000 --- a/vendor/github.com/go-kit/kit/circle.yml +++ /dev/null @@ -1,27 +0,0 @@ -machine: - pre: - - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 - - sudo rm -rf /usr/local/go - - curl -sSL https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz | sudo tar xz -C /usr/local - services: - - docker - -dependencies: - pre: - - sudo curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose - - sudo chmod +x /usr/local/bin/docker-compose - - docker-compose -f docker-compose-integration.yml up -d --force-recreate - -test: - pre: - - mkdir -p /home/ubuntu/.go_workspace/src/github.com/go-kit - - mv /home/ubuntu/kit /home/ubuntu/.go_workspace/src/github.com/go-kit - - ln -s /home/ubuntu/.go_workspace/src/github.com/go-kit/kit /home/ubuntu/kit - - go get -t github.com/go-kit/kit/... - override: - - go test -v -race -tags integration github.com/go-kit/kit/...: - environment: - ETCD_ADDR: http://localhost:2379 - CONSUL_ADDR: localhost:8500 - ZK_ADDR: localhost:2181 - EUREKA_ADDR: http://localhost:8761/eureka diff --git a/vendor/github.com/go-kit/kit/coveralls.bash b/vendor/github.com/go-kit/kit/coveralls.bash deleted file mode 100755 index cf8fee93..00000000 --- a/vendor/github.com/go-kit/kit/coveralls.bash +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -if ! type -P gover -then - echo gover missing: go get github.com/modocache/gover - exit 1 -fi - -if ! type -P goveralls -then - echo goveralls missing: go get github.com/mattn/goveralls - exit 1 -fi - -if [[ "$COVERALLS_TOKEN" == "" ]] -then - echo COVERALLS_TOKEN not set - exit 1 -fi - -go list ./... | grep -v '/examples/' | cut -d'/' -f 4- | while read d -do - cd $d - go test -covermode count -coverprofile coverage.coverprofile - cd - -done - -gover -goveralls -coverprofile gover.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN -find . -name '*.coverprofile' -delete - diff --git a/vendor/github.com/go-kit/kit/docker-compose-integration.yml b/vendor/github.com/go-kit/kit/docker-compose-integration.yml deleted file mode 100644 index 287d97db..00000000 --- a/vendor/github.com/go-kit/kit/docker-compose-integration.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '2' -services: - etcd: - image: quay.io/coreos/etcd - ports: - - "2379:2379" - command: /usr/local/bin/etcd -advertise-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 -listen-client-urls "http://0.0.0.0:2379,http://0.0.0.0:4001" - consul: - image: progrium/consul - ports: - - "8500:8500" - command: -server -bootstrap - zk: - image: zookeeper - ports: - - "2181:2181" - eureka: - image: springcloud/eureka - environment: - eureka.server.responseCacheUpdateIntervalMs: 1000 - ports: - - "8761:8761" diff --git a/vendor/github.com/go-kit/kit/lint b/vendor/github.com/go-kit/kit/lint deleted file mode 100755 index 12e30727..00000000 --- a/vendor/github.com/go-kit/kit/lint +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -if [ ! $(command -v gometalinter) ] -then - go get github.com/alecthomas/gometalinter - gometalinter --update --install -fi - -time gometalinter \ - --exclude='error return value not checked.*(Close|Log|Print).*\(errcheck\)$' \ - --exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$' \ - --exclude='/thrift/' \ - --exclude='/pb/' \ - --exclude='no args in Log call \(vet\)' \ - --disable=dupl \ - --disable=aligncheck \ - --disable=gotype \ - --cyclo-over=20 \ - --tests \ - --concurrency=2 \ - --deadline=300s \ - ./... diff --git a/vendor/github.com/go-kit/kit/log/README.md b/vendor/github.com/go-kit/kit/log/README.md deleted file mode 100644 index 7222f800..00000000 --- a/vendor/github.com/go-kit/kit/log/README.md +++ /dev/null @@ -1,147 +0,0 @@ -# package log - -`package log` provides a minimal interface for structured logging in services. -It may be wrapped to encode conventions, enforce type-safety, provide leveled -logging, and so on. It can be used for both typical application log events, -and log-structured data streams. - -## Structured logging - -Structured logging is, basically, conceding to the reality that logs are -_data_, and warrant some level of schematic rigor. Using a stricter, -key/value-oriented message format for our logs, containing contextual and -semantic information, makes it much easier to get insight into the -operational activity of the systems we build. Consequently, `package log` is -of the strong belief that "[the benefits of structured logging outweigh the -minimal effort involved](https://www.thoughtworks.com/radar/techniques/structured-logging)". - -Migrating from unstructured to structured logging is probably a lot easier -than you'd expect. - -```go -// Unstructured -log.Printf("HTTP server listening on %s", addr) - -// Structured -logger.Log("transport", "HTTP", "addr", addr, "msg", "listening") -``` - -## Usage - -### Typical application logging - -```go -w := log.NewSyncWriter(os.Stderr) -logger := log.NewLogfmtLogger(w) -logger.Log("question", "what is the meaning of life?", "answer", 42) - -// Output: -// question="what is the meaning of life?" answer=42 -``` - -### Contextual Loggers - -```go -func main() { - var logger log.Logger - logger = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) - logger = log.With(logger, "instance_id", 123) - - logger.Log("msg", "starting") - NewWorker(log.With(logger, "component", "worker")).Run() - NewSlacker(log.With(logger, "component", "slacker")).Run() -} - -// Output: -// instance_id=123 msg=starting -// instance_id=123 component=worker msg=running -// instance_id=123 component=slacker msg=running -``` - -### Interact with stdlib logger - -Redirect stdlib logger to Go kit logger. - -```go -import ( - "os" - stdlog "log" - kitlog "github.com/go-kit/kit/log" -) - -func main() { - logger := kitlog.NewJSONLogger(kitlog.NewSyncWriter(os.Stdout)) - stdlog.SetOutput(kitlog.NewStdlibAdapter(logger)) - stdlog.Print("I sure like pie") -} - -// Output: -// {"msg":"I sure like pie","ts":"2016/01/01 12:34:56"} -``` - -Or, if, for legacy reasons, you need to pipe all of your logging through the -stdlib log package, you can redirect Go kit logger to the stdlib logger. - -```go -logger := kitlog.NewLogfmtLogger(kitlog.StdlibWriter{}) -logger.Log("legacy", true, "msg", "at least it's something") - -// Output: -// 2016/01/01 12:34:56 legacy=true msg="at least it's something" -``` - -### Timestamps and callers - -```go -var logger log.Logger -logger = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) -logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) - -logger.Log("msg", "hello") - -// Output: -// ts=2016-01-01T12:34:56Z caller=main.go:15 msg=hello -``` - -## Supported output formats - -- [Logfmt](https://brandur.org/logfmt) ([see also](https://blog.codeship.com/logfmt-a-log-format-thats-easy-to-read-and-write)) -- JSON - -## Enhancements - -`package log` is centered on the one-method Logger interface. - -```go -type Logger interface { - Log(keyvals ...interface{}) error -} -``` - -This interface, and its supporting code like is the product of much iteration -and evaluation. For more details on the evolution of the Logger interface, -see [The Hunt for a Logger Interface](http://go-talks.appspot.com/github.com/ChrisHines/talks/structured-logging/structured-logging.slide#1), -a talk by [Chris Hines](https://github.com/ChrisHines). -Also, please see -[#63](https://github.com/go-kit/kit/issues/63), -[#76](https://github.com/go-kit/kit/pull/76), -[#131](https://github.com/go-kit/kit/issues/131), -[#157](https://github.com/go-kit/kit/pull/157), -[#164](https://github.com/go-kit/kit/issues/164), and -[#252](https://github.com/go-kit/kit/pull/252) -to review historical conversations about package log and the Logger interface. - -Value-add packages and suggestions, -like improvements to [the leveled logger](https://godoc.org/github.com/go-kit/kit/log/level), -are of course welcome. Good proposals should - -- Be composable with [contextual loggers](https://godoc.org/github.com/go-kit/kit/log#With), -- Not break the behavior of [log.Caller](https://godoc.org/github.com/go-kit/kit/log#Caller) in any wrapped contextual loggers, and -- Be friendly to packages that accept only an unadorned log.Logger. - -## Benchmarks & comparisons - -There are a few Go logging benchmarks and comparisons that include Go kit's package log. - -- [imkira/go-loggers-bench](https://github.com/imkira/go-loggers-bench) includes kit/log -- [uber-common/zap](https://github.com/uber-common/zap), a zero-alloc logging library, includes a comparison with kit/log diff --git a/vendor/github.com/go-kit/kit/log/benchmark_test.go b/vendor/github.com/go-kit/kit/log/benchmark_test.go deleted file mode 100644 index 126bfa5a..00000000 --- a/vendor/github.com/go-kit/kit/log/benchmark_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package log_test - -import ( - "testing" - - "github.com/go-kit/kit/log" -) - -func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { - lc := log.With(logger, "common_key", "common_value") - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - f(lc) - } -} - -var ( - baseMessage = func(logger log.Logger) { logger.Log("foo_key", "foo_value") } - withMessage = func(logger log.Logger) { log.With(logger, "a", "b").Log("c", "d") } -) diff --git a/vendor/github.com/go-kit/kit/log/concurrency_test.go b/vendor/github.com/go-kit/kit/log/concurrency_test.go deleted file mode 100644 index 95a749e7..00000000 --- a/vendor/github.com/go-kit/kit/log/concurrency_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package log_test - -import ( - "math" - "testing" - - "github.com/go-kit/kit/log" -) - -// These test are designed to be run with the race detector. - -func testConcurrency(t *testing.T, logger log.Logger, total int) { - n := int(math.Sqrt(float64(total))) - share := total / n - - errC := make(chan error, n) - - for i := 0; i < n; i++ { - go func() { - errC <- spam(logger, share) - }() - } - - for i := 0; i < n; i++ { - err := <-errC - if err != nil { - t.Fatalf("concurrent logging error: %v", err) - } - } -} - -func spam(logger log.Logger, count int) error { - for i := 0; i < count; i++ { - err := logger.Log("key", i) - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/go-kit/kit/log/doc.go b/vendor/github.com/go-kit/kit/log/doc.go deleted file mode 100644 index 918c0af4..00000000 --- a/vendor/github.com/go-kit/kit/log/doc.go +++ /dev/null @@ -1,116 +0,0 @@ -// Package log provides a structured logger. -// -// Structured logging produces logs easily consumed later by humans or -// machines. Humans might be interested in debugging errors, or tracing -// specific requests. Machines might be interested in counting interesting -// events, or aggregating information for off-line processing. In both cases, -// it is important that the log messages are structured and actionable. -// Package log is designed to encourage both of these best practices. -// -// Basic Usage -// -// The fundamental interface is Logger. Loggers create log events from -// key/value data. The Logger interface has a single method, Log, which -// accepts a sequence of alternating key/value pairs, which this package names -// keyvals. -// -// type Logger interface { -// Log(keyvals ...interface{}) error -// } -// -// Here is an example of a function using a Logger to create log events. -// -// func RunTask(task Task, logger log.Logger) string { -// logger.Log("taskID", task.ID, "event", "starting task") -// ... -// logger.Log("taskID", task.ID, "event", "task complete") -// } -// -// The keys in the above example are "taskID" and "event". The values are -// task.ID, "starting task", and "task complete". Every key is followed -// immediately by its value. -// -// Keys are usually plain strings. Values may be any type that has a sensible -// encoding in the chosen log format. With structured logging it is a good -// idea to log simple values without formatting them. This practice allows -// the chosen logger to encode values in the most appropriate way. -// -// Contextual Loggers -// -// A contextual logger stores keyvals that it includes in all log events. -// Building appropriate contextual loggers reduces repetition and aids -// consistency in the resulting log output. With and WithPrefix add context to -// a logger. We can use With to improve the RunTask example. -// -// func RunTask(task Task, logger log.Logger) string { -// logger = log.With(logger, "taskID", task.ID) -// logger.Log("event", "starting task") -// ... -// taskHelper(task.Cmd, logger) -// ... -// logger.Log("event", "task complete") -// } -// -// The improved version emits the same log events as the original for the -// first and last calls to Log. Passing the contextual logger to taskHelper -// enables each log event created by taskHelper to include the task.ID even -// though taskHelper does not have access to that value. Using contextual -// loggers this way simplifies producing log output that enables tracing the -// life cycle of individual tasks. (See the Contextual example for the full -// code of the above snippet.) -// -// Dynamic Contextual Values -// -// A Valuer function stored in a contextual logger generates a new value each -// time an event is logged. The Valuer example demonstrates how this feature -// works. -// -// Valuers provide the basis for consistently logging timestamps and source -// code location. The log package defines several valuers for that purpose. -// See Timestamp, DefaultTimestamp, DefaultTimestampUTC, Caller, and -// DefaultCaller. A common logger initialization sequence that ensures all log -// entries contain a timestamp and source location looks like this: -// -// logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) -// logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) -// -// Concurrent Safety -// -// Applications with multiple goroutines want each log event written to the -// same logger to remain separate from other log events. Package log provides -// two simple solutions for concurrent safe logging. -// -// NewSyncWriter wraps an io.Writer and serializes each call to its Write -// method. Using a SyncWriter has the benefit that the smallest practical -// portion of the logging logic is performed within a mutex, but it requires -// the formatting Logger to make only one call to Write per log event. -// -// NewSyncLogger wraps any Logger and serializes each call to its Log method. -// Using a SyncLogger has the benefit that it guarantees each log event is -// handled atomically within the wrapped logger, but it typically serializes -// both the formatting and output logic. Use a SyncLogger if the formatting -// logger may perform multiple writes per log event. -// -// Error Handling -// -// This package relies on the practice of wrapping or decorating loggers with -// other loggers to provide composable pieces of functionality. It also means -// that Logger.Log must return an error because some -// implementations—especially those that output log data to an io.Writer—may -// encounter errors that cannot be handled locally. This in turn means that -// Loggers that wrap other loggers should return errors from the wrapped -// logger up the stack. -// -// Fortunately, the decorator pattern also provides a way to avoid the -// necessity to check for errors every time an application calls Logger.Log. -// An application required to panic whenever its Logger encounters -// an error could initialize its logger as follows. -// -// fmtlogger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) -// logger := log.LoggerFunc(func(keyvals ...interface{}) error { -// if err := fmtlogger.Log(keyvals...); err != nil { -// panic(err) -// } -// return nil -// }) -package log diff --git a/vendor/github.com/go-kit/kit/log/example_test.go b/vendor/github.com/go-kit/kit/log/example_test.go deleted file mode 100644 index 97667748..00000000 --- a/vendor/github.com/go-kit/kit/log/example_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package log_test - -import ( - "math/rand" - "os" - "sync" - "time" - - "github.com/go-kit/kit/log" -) - -func Example_basic() { - logger := log.NewLogfmtLogger(os.Stdout) - - type Task struct { - ID int - } - - RunTask := func(task Task, logger log.Logger) { - logger.Log("taskID", task.ID, "event", "starting task") - - logger.Log("taskID", task.ID, "event", "task complete") - } - - RunTask(Task{ID: 1}, logger) - - // Output: - // taskID=1 event="starting task" - // taskID=1 event="task complete" -} - -func Example_contextual() { - logger := log.NewLogfmtLogger(os.Stdout) - - type Task struct { - ID int - Cmd string - } - - taskHelper := func(cmd string, logger log.Logger) { - // execute(cmd) - logger.Log("cmd", cmd, "dur", 42*time.Millisecond) - } - - RunTask := func(task Task, logger log.Logger) { - logger = log.With(logger, "taskID", task.ID) - logger.Log("event", "starting task") - - taskHelper(task.Cmd, logger) - - logger.Log("event", "task complete") - } - - RunTask(Task{ID: 1, Cmd: "echo Hello, world!"}, logger) - - // Output: - // taskID=1 event="starting task" - // taskID=1 cmd="echo Hello, world!" dur=42ms - // taskID=1 event="task complete" -} - -func Example_valuer() { - logger := log.NewLogfmtLogger(os.Stdout) - - count := 0 - counter := func() interface{} { - count++ - return count - } - - logger = log.With(logger, "count", log.Valuer(counter)) - - logger.Log("call", "first") - logger.Log("call", "second") - - // Output: - // count=1 call=first - // count=2 call=second -} - -func Example_debugInfo() { - logger := log.NewLogfmtLogger(os.Stdout) - - // make time predictable for this test - baseTime := time.Date(2015, time.February, 3, 10, 0, 0, 0, time.UTC) - mockTime := func() time.Time { - baseTime = baseTime.Add(time.Second) - return baseTime - } - - logger = log.With(logger, "time", log.Timestamp(mockTime), "caller", log.DefaultCaller) - - logger.Log("call", "first") - logger.Log("call", "second") - - // ... - - logger.Log("call", "third") - - // Output: - // time=2015-02-03T10:00:01Z caller=example_test.go:93 call=first - // time=2015-02-03T10:00:02Z caller=example_test.go:94 call=second - // time=2015-02-03T10:00:03Z caller=example_test.go:98 call=third -} - -func Example_syncWriter() { - w := log.NewSyncWriter(os.Stdout) - logger := log.NewLogfmtLogger(w) - - type Task struct { - ID int - } - - var wg sync.WaitGroup - - RunTask := func(task Task, logger log.Logger) { - logger.Log("taskID", task.ID, "event", "starting task") - - time.Sleep(time.Duration(rand.Intn(200)) * time.Millisecond) - - logger.Log("taskID", task.ID, "event", "task complete") - wg.Done() - } - - wg.Add(2) - - go RunTask(Task{ID: 1}, logger) - go RunTask(Task{ID: 2}, logger) - - wg.Wait() - - // Unordered output: - // taskID=1 event="starting task" - // taskID=2 event="starting task" - // taskID=1 event="task complete" - // taskID=2 event="task complete" -} diff --git a/vendor/github.com/go-kit/kit/log/json_logger.go b/vendor/github.com/go-kit/kit/log/json_logger.go deleted file mode 100644 index 66094b4d..00000000 --- a/vendor/github.com/go-kit/kit/log/json_logger.go +++ /dev/null @@ -1,89 +0,0 @@ -package log - -import ( - "encoding" - "encoding/json" - "fmt" - "io" - "reflect" -) - -type jsonLogger struct { - io.Writer -} - -// NewJSONLogger returns a Logger that encodes keyvals to the Writer as a -// single JSON object. Each log event produces no more than one call to -// w.Write. The passed Writer must be safe for concurrent use by multiple -// goroutines if the returned Logger will be used concurrently. -func NewJSONLogger(w io.Writer) Logger { - return &jsonLogger{w} -} - -func (l *jsonLogger) Log(keyvals ...interface{}) error { - n := (len(keyvals) + 1) / 2 // +1 to handle case when len is odd - m := make(map[string]interface{}, n) - for i := 0; i < len(keyvals); i += 2 { - k := keyvals[i] - var v interface{} = ErrMissingValue - if i+1 < len(keyvals) { - v = keyvals[i+1] - } - merge(m, k, v) - } - return json.NewEncoder(l.Writer).Encode(m) -} - -func merge(dst map[string]interface{}, k, v interface{}) { - var key string - switch x := k.(type) { - case string: - key = x - case fmt.Stringer: - key = safeString(x) - default: - key = fmt.Sprint(x) - } - - // We want json.Marshaler and encoding.TextMarshaller to take priority over - // err.Error() and v.String(). But json.Marshall (called later) does that by - // default so we force a no-op if it's one of those 2 case. - switch x := v.(type) { - case json.Marshaler: - case encoding.TextMarshaler: - case error: - v = safeError(x) - case fmt.Stringer: - v = safeString(x) - } - - dst[key] = v -} - -func safeString(str fmt.Stringer) (s string) { - defer func() { - if panicVal := recover(); panicVal != nil { - if v := reflect.ValueOf(str); v.Kind() == reflect.Ptr && v.IsNil() { - s = "NULL" - } else { - panic(panicVal) - } - } - }() - s = str.String() - return -} - -func safeError(err error) (s interface{}) { - defer func() { - if panicVal := recover(); panicVal != nil { - if v := reflect.ValueOf(err); v.Kind() == reflect.Ptr && v.IsNil() { - s = nil - } else { - panic(panicVal) - } - } - }() - s = err.Error() - return -} diff --git a/vendor/github.com/go-kit/kit/log/json_logger_test.go b/vendor/github.com/go-kit/kit/log/json_logger_test.go deleted file mode 100644 index e3e30909..00000000 --- a/vendor/github.com/go-kit/kit/log/json_logger_test.go +++ /dev/null @@ -1,162 +0,0 @@ -package log_test - -import ( - "bytes" - "errors" - "io/ioutil" - "testing" - - "github.com/go-kit/kit/log" -) - -func TestJSONLoggerCaller(t *testing.T) { - t.Parallel() - buf := &bytes.Buffer{} - logger := log.NewJSONLogger(buf) - logger = log.With(logger, "caller", log.DefaultCaller) - - if err := logger.Log(); err != nil { - t.Fatal(err) - } - if want, have := `{"caller":"json_logger_test.go:18"}`+"\n", buf.String(); want != have { - t.Errorf("\nwant %#v\nhave %#v", want, have) - } -} - -func TestJSONLogger(t *testing.T) { - t.Parallel() - buf := &bytes.Buffer{} - logger := log.NewJSONLogger(buf) - if err := logger.Log("err", errors.New("err"), "m", map[string]int{"0": 0}, "a", []int{1, 2, 3}); err != nil { - t.Fatal(err) - } - if want, have := `{"a":[1,2,3],"err":"err","m":{"0":0}}`+"\n", buf.String(); want != have { - t.Errorf("\nwant %#v\nhave %#v", want, have) - } -} - -func TestJSONLoggerMissingValue(t *testing.T) { - t.Parallel() - buf := &bytes.Buffer{} - logger := log.NewJSONLogger(buf) - if err := logger.Log("k"); err != nil { - t.Fatal(err) - } - if want, have := `{"k":"(MISSING)"}`+"\n", buf.String(); want != have { - t.Errorf("\nwant %#v\nhave %#v", want, have) - } -} - -func TestJSONLoggerNilStringerKey(t *testing.T) { - t.Parallel() - - buf := &bytes.Buffer{} - logger := log.NewJSONLogger(buf) - if err := logger.Log((*stringer)(nil), "v"); err != nil { - t.Fatal(err) - } - if want, have := `{"NULL":"v"}`+"\n", buf.String(); want != have { - t.Errorf("\nwant %#v\nhave %#v", want, have) - } -} - -func TestJSONLoggerNilErrorValue(t *testing.T) { - t.Parallel() - - buf := &bytes.Buffer{} - logger := log.NewJSONLogger(buf) - if err := logger.Log("err", (*stringError)(nil)); err != nil { - t.Fatal(err) - } - if want, have := `{"err":null}`+"\n", buf.String(); want != have { - t.Errorf("\nwant %#v\nhave %#v", want, have) - } -} - -// aller implements json.Marshaler, encoding.TextMarshaler, and fmt.Stringer. -type aller struct{} - -func (aller) MarshalJSON() ([]byte, error) { - return []byte("\"json\""), nil -} - -func (aller) MarshalText() ([]byte, error) { - return []byte("text"), nil -} - -func (aller) String() string { - return "string" -} - -func (aller) Error() string { - return "error" -} - -// textstringer implements encoding.TextMarshaler and fmt.Stringer. -type textstringer struct{} - -func (textstringer) MarshalText() ([]byte, error) { - return []byte("text"), nil -} - -func (textstringer) String() string { - return "string" -} - -func TestJSONLoggerStringValue(t *testing.T) { - t.Parallel() - tests := []struct { - v interface{} - expected string - }{ - { - v: aller{}, - expected: `{"v":"json"}`, - }, - { - v: textstringer{}, - expected: `{"v":"text"}`, - }, - { - v: stringer("string"), - expected: `{"v":"string"}`, - }, - } - - for _, test := range tests { - buf := &bytes.Buffer{} - logger := log.NewJSONLogger(buf) - if err := logger.Log("v", test.v); err != nil { - t.Fatal(err) - } - - if want, have := test.expected+"\n", buf.String(); want != have { - t.Errorf("\nwant %#v\nhave %#v", want, have) - } - } -} - -type stringer string - -func (s stringer) String() string { - return string(s) -} - -type stringError string - -func (s stringError) Error() string { - return string(s) -} - -func BenchmarkJSONLoggerSimple(b *testing.B) { - benchmarkRunner(b, log.NewJSONLogger(ioutil.Discard), baseMessage) -} - -func BenchmarkJSONLoggerContextual(b *testing.B) { - benchmarkRunner(b, log.NewJSONLogger(ioutil.Discard), withMessage) -} - -func TestJSONLoggerConcurrency(t *testing.T) { - t.Parallel() - testConcurrency(t, log.NewJSONLogger(ioutil.Discard), 10000) -} diff --git a/vendor/github.com/go-kit/kit/log/log.go b/vendor/github.com/go-kit/kit/log/log.go deleted file mode 100644 index 66a9e2fd..00000000 --- a/vendor/github.com/go-kit/kit/log/log.go +++ /dev/null @@ -1,135 +0,0 @@ -package log - -import "errors" - -// Logger is the fundamental interface for all log operations. Log creates a -// log event from keyvals, a variadic sequence of alternating keys and values. -// Implementations must be safe for concurrent use by multiple goroutines. In -// particular, any implementation of Logger that appends to keyvals or -// modifies or retains any of its elements must make a copy first. -type Logger interface { - Log(keyvals ...interface{}) error -} - -// ErrMissingValue is appended to keyvals slices with odd length to substitute -// the missing value. -var ErrMissingValue = errors.New("(MISSING)") - -// With returns a new contextual logger with keyvals prepended to those passed -// to calls to Log. If logger is also a contextual logger created by With or -// WithPrefix, keyvals is appended to the existing context. -// -// The returned Logger replaces all value elements (odd indexes) containing a -// Valuer with their generated value for each call to its Log method. -func With(logger Logger, keyvals ...interface{}) Logger { - if len(keyvals) == 0 { - return logger - } - l := newContext(logger) - kvs := append(l.keyvals, keyvals...) - if len(kvs)%2 != 0 { - kvs = append(kvs, ErrMissingValue) - } - return &context{ - logger: l.logger, - // Limiting the capacity of the stored keyvals ensures that a new - // backing array is created if the slice must grow in Log or With. - // Using the extra capacity without copying risks a data race that - // would violate the Logger interface contract. - keyvals: kvs[:len(kvs):len(kvs)], - hasValuer: l.hasValuer || containsValuer(keyvals), - } -} - -// WithPrefix returns a new contextual logger with keyvals prepended to those -// passed to calls to Log. If logger is also a contextual logger created by -// With or WithPrefix, keyvals is prepended to the existing context. -// -// The returned Logger replaces all value elements (odd indexes) containing a -// Valuer with their generated value for each call to its Log method. -func WithPrefix(logger Logger, keyvals ...interface{}) Logger { - if len(keyvals) == 0 { - return logger - } - l := newContext(logger) - // Limiting the capacity of the stored keyvals ensures that a new - // backing array is created if the slice must grow in Log or With. - // Using the extra capacity without copying risks a data race that - // would violate the Logger interface contract. - n := len(l.keyvals) + len(keyvals) - if len(keyvals)%2 != 0 { - n++ - } - kvs := make([]interface{}, 0, n) - kvs = append(kvs, keyvals...) - if len(kvs)%2 != 0 { - kvs = append(kvs, ErrMissingValue) - } - kvs = append(kvs, l.keyvals...) - return &context{ - logger: l.logger, - keyvals: kvs, - hasValuer: l.hasValuer || containsValuer(keyvals), - } -} - -// context is the Logger implementation returned by With and WithPrefix. It -// wraps a Logger and holds keyvals that it includes in all log events. Its -// Log method calls bindValues to generate values for each Valuer in the -// context keyvals. -// -// A context must always have the same number of stack frames between calls to -// its Log method and the eventual binding of Valuers to their value. This -// requirement comes from the functional requirement to allow a context to -// resolve application call site information for a Caller stored in the -// context. To do this we must be able to predict the number of logging -// functions on the stack when bindValues is called. -// -// Two implementation details provide the needed stack depth consistency. -// -// 1. newContext avoids introducing an additional layer when asked to -// wrap another context. -// 2. With and WithPrefix avoid introducing an additional layer by -// returning a newly constructed context with a merged keyvals rather -// than simply wrapping the existing context. -type context struct { - logger Logger - keyvals []interface{} - hasValuer bool -} - -func newContext(logger Logger) *context { - if c, ok := logger.(*context); ok { - return c - } - return &context{logger: logger} -} - -// Log replaces all value elements (odd indexes) containing a Valuer in the -// stored context with their generated value, appends keyvals, and passes the -// result to the wrapped Logger. -func (l *context) Log(keyvals ...interface{}) error { - kvs := append(l.keyvals, keyvals...) - if len(kvs)%2 != 0 { - kvs = append(kvs, ErrMissingValue) - } - if l.hasValuer { - // If no keyvals were appended above then we must copy l.keyvals so - // that future log events will reevaluate the stored Valuers. - if len(keyvals) == 0 { - kvs = append([]interface{}{}, l.keyvals...) - } - bindValues(kvs[:len(l.keyvals)]) - } - return l.logger.Log(kvs...) -} - -// LoggerFunc is an adapter to allow use of ordinary functions as Loggers. If -// f is a function with the appropriate signature, LoggerFunc(f) is a Logger -// object that calls f. -type LoggerFunc func(...interface{}) error - -// Log implements Logger by calling f(keyvals...). -func (f LoggerFunc) Log(keyvals ...interface{}) error { - return f(keyvals...) -} diff --git a/vendor/github.com/go-kit/kit/log/log_test.go b/vendor/github.com/go-kit/kit/log/log_test.go deleted file mode 100644 index 1bf29727..00000000 --- a/vendor/github.com/go-kit/kit/log/log_test.go +++ /dev/null @@ -1,191 +0,0 @@ -package log_test - -import ( - "bytes" - "fmt" - "sync" - "testing" - - "github.com/go-kit/kit/log" - "github.com/go-stack/stack" -) - -func TestContext(t *testing.T) { - t.Parallel() - buf := &bytes.Buffer{} - logger := log.NewLogfmtLogger(buf) - - kvs := []interface{}{"a", 123} - lc := log.With(logger, kvs...) - kvs[1] = 0 // With should copy its key values - - lc = log.With(lc, "b", "c") // With should stack - if err := lc.Log("msg", "message"); err != nil { - t.Fatal(err) - } - if want, have := "a=123 b=c msg=message\n", buf.String(); want != have { - t.Errorf("\nwant: %shave: %s", want, have) - } - - buf.Reset() - lc = log.WithPrefix(lc, "p", "first") - if err := lc.Log("msg", "message"); err != nil { - t.Fatal(err) - } - if want, have := "p=first a=123 b=c msg=message\n", buf.String(); want != have { - t.Errorf("\nwant: %shave: %s", want, have) - } -} - -func TestContextMissingValue(t *testing.T) { - t.Parallel() - var output []interface{} - logger := log.Logger(log.LoggerFunc(func(keyvals ...interface{}) error { - output = keyvals - return nil - })) - - log.WithPrefix(log.With(logger, "k1"), "k0").Log("k2") - if want, have := 6, len(output); want != have { - t.Errorf("want len(output) == %v, have %v", want, have) - } - for i := 1; i < 6; i += 2 { - if want, have := log.ErrMissingValue, output[i]; want != have { - t.Errorf("want output[%d] == %#v, have %#v", i, want, have) - } - } -} - -// Test that context.Log has a consistent function stack depth when binding -// Valuers, regardless of how many times With has been called. -func TestContextStackDepth(t *testing.T) { - t.Parallel() - fn := fmt.Sprintf("%n", stack.Caller(0)) - - var output []interface{} - - logger := log.Logger(log.LoggerFunc(func(keyvals ...interface{}) error { - output = keyvals - return nil - })) - - stackValuer := log.Valuer(func() interface{} { - for i, c := range stack.Trace() { - if fmt.Sprintf("%n", c) == fn { - return i - } - } - t.Fatal("Test function not found in stack trace.") - return nil - }) - - logger = log.With(logger, "stack", stackValuer) - - // Call through interface to get baseline. - logger.Log("k", "v") - want := output[1].(int) - - for len(output) < 10 { - logger.Log("k", "v") - if have := output[1]; have != want { - t.Errorf("%d Withs: have %v, want %v", len(output)/2-1, have, want) - } - - wrapped := log.With(logger) - wrapped.Log("k", "v") - if have := output[1]; have != want { - t.Errorf("%d Withs: have %v, want %v", len(output)/2-1, have, want) - } - - logger = log.With(logger, "k", "v") - } -} - -// Test that With returns a Logger safe for concurrent use. This test -// validates that the stored logging context does not get corrupted when -// multiple clients concurrently log additional keyvals. -// -// This test must be run with go test -cpu 2 (or more) to achieve its goal. -func TestWithConcurrent(t *testing.T) { - // Create some buckets to count how many events each goroutine logs. - const goroutines = 8 - counts := [goroutines]int{} - - // This logger extracts a goroutine id from the last value field and - // increments the referenced bucket. - logger := log.LoggerFunc(func(kv ...interface{}) error { - goroutine := kv[len(kv)-1].(int) - counts[goroutine]++ - return nil - }) - - // With must be careful about handling slices that can grow without - // copying the underlying array, so give it a challenge. - l := log.With(logger, make([]interface{}, 0, 2)...) - - // Start logging concurrently. Each goroutine logs its id so the logger - // can bucket the event counts. - var wg sync.WaitGroup - wg.Add(goroutines) - const n = 10000 - for i := 0; i < goroutines; i++ { - go func(idx int) { - defer wg.Done() - for j := 0; j < n; j++ { - l.Log("goroutineIdx", idx) - } - }(i) - } - wg.Wait() - - for bucket, have := range counts { - if want := n; want != have { - t.Errorf("bucket %d: want %d, have %d", bucket, want, have) // note Errorf - } - } -} - -func BenchmarkDiscard(b *testing.B) { - logger := log.NewNopLogger() - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - logger.Log("k", "v") - } -} - -func BenchmarkOneWith(b *testing.B) { - logger := log.NewNopLogger() - lc := log.With(logger, "k", "v") - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - lc.Log("k", "v") - } -} - -func BenchmarkTwoWith(b *testing.B) { - logger := log.NewNopLogger() - lc := log.With(logger, "k", "v") - for i := 1; i < 2; i++ { - lc = log.With(lc, "k", "v") - } - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - lc.Log("k", "v") - } -} - -func BenchmarkTenWith(b *testing.B) { - logger := log.NewNopLogger() - lc := log.With(logger, "k", "v") - for i := 1; i < 10; i++ { - lc = log.With(lc, "k", "v") - } - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - lc.Log("k", "v") - } -} diff --git a/vendor/github.com/go-kit/kit/log/logfmt_logger.go b/vendor/github.com/go-kit/kit/log/logfmt_logger.go deleted file mode 100644 index a0030529..00000000 --- a/vendor/github.com/go-kit/kit/log/logfmt_logger.go +++ /dev/null @@ -1,62 +0,0 @@ -package log - -import ( - "bytes" - "io" - "sync" - - "github.com/go-logfmt/logfmt" -) - -type logfmtEncoder struct { - *logfmt.Encoder - buf bytes.Buffer -} - -func (l *logfmtEncoder) Reset() { - l.Encoder.Reset() - l.buf.Reset() -} - -var logfmtEncoderPool = sync.Pool{ - New: func() interface{} { - var enc logfmtEncoder - enc.Encoder = logfmt.NewEncoder(&enc.buf) - return &enc - }, -} - -type logfmtLogger struct { - w io.Writer -} - -// NewLogfmtLogger returns a logger that encodes keyvals to the Writer in -// logfmt format. Each log event produces no more than one call to w.Write. -// The passed Writer must be safe for concurrent use by multiple goroutines if -// the returned Logger will be used concurrently. -func NewLogfmtLogger(w io.Writer) Logger { - return &logfmtLogger{w} -} - -func (l logfmtLogger) Log(keyvals ...interface{}) error { - enc := logfmtEncoderPool.Get().(*logfmtEncoder) - enc.Reset() - defer logfmtEncoderPool.Put(enc) - - if err := enc.EncodeKeyvals(keyvals...); err != nil { - return err - } - - // Add newline to the end of the buffer - if err := enc.EndRecord(); err != nil { - return err - } - - // The Logger interface requires implementations to be safe for concurrent - // use by multiple goroutines. For this implementation that means making - // only one call to l.w.Write() for each call to Log. - if _, err := l.w.Write(enc.buf.Bytes()); err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/go-kit/kit/log/logfmt_logger_test.go b/vendor/github.com/go-kit/kit/log/logfmt_logger_test.go deleted file mode 100644 index 91bbca15..00000000 --- a/vendor/github.com/go-kit/kit/log/logfmt_logger_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package log_test - -import ( - "bytes" - "errors" - "io/ioutil" - "testing" - - "github.com/go-kit/kit/log" - "github.com/go-logfmt/logfmt" -) - -func TestLogfmtLogger(t *testing.T) { - t.Parallel() - buf := &bytes.Buffer{} - logger := log.NewLogfmtLogger(buf) - - if err := logger.Log("hello", "world"); err != nil { - t.Fatal(err) - } - if want, have := "hello=world\n", buf.String(); want != have { - t.Errorf("want %#v, have %#v", want, have) - } - - buf.Reset() - if err := logger.Log("a", 1, "err", errors.New("error")); err != nil { - t.Fatal(err) - } - if want, have := "a=1 err=error\n", buf.String(); want != have { - t.Errorf("want %#v, have %#v", want, have) - } - - buf.Reset() - if err := logger.Log("std_map", map[int]int{1: 2}, "my_map", mymap{0: 0}); err != nil { - t.Fatal(err) - } - if want, have := "std_map=\""+logfmt.ErrUnsupportedValueType.Error()+"\" my_map=special_behavior\n", buf.String(); want != have { - t.Errorf("want %#v, have %#v", want, have) - } -} - -func BenchmarkLogfmtLoggerSimple(b *testing.B) { - benchmarkRunner(b, log.NewLogfmtLogger(ioutil.Discard), baseMessage) -} - -func BenchmarkLogfmtLoggerContextual(b *testing.B) { - benchmarkRunner(b, log.NewLogfmtLogger(ioutil.Discard), withMessage) -} - -func TestLogfmtLoggerConcurrency(t *testing.T) { - t.Parallel() - testConcurrency(t, log.NewLogfmtLogger(ioutil.Discard), 10000) -} - -type mymap map[int]int - -func (m mymap) String() string { return "special_behavior" } diff --git a/vendor/github.com/go-kit/kit/log/nop_logger.go b/vendor/github.com/go-kit/kit/log/nop_logger.go deleted file mode 100644 index 1047d626..00000000 --- a/vendor/github.com/go-kit/kit/log/nop_logger.go +++ /dev/null @@ -1,8 +0,0 @@ -package log - -type nopLogger struct{} - -// NewNopLogger returns a logger that doesn't do anything. -func NewNopLogger() Logger { return nopLogger{} } - -func (nopLogger) Log(...interface{}) error { return nil } diff --git a/vendor/github.com/go-kit/kit/log/nop_logger_test.go b/vendor/github.com/go-kit/kit/log/nop_logger_test.go deleted file mode 100644 index 908ddd81..00000000 --- a/vendor/github.com/go-kit/kit/log/nop_logger_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package log_test - -import ( - "testing" - - "github.com/go-kit/kit/log" -) - -func TestNopLogger(t *testing.T) { - t.Parallel() - logger := log.NewNopLogger() - if err := logger.Log("abc", 123); err != nil { - t.Error(err) - } - if err := log.With(logger, "def", "ghi").Log(); err != nil { - t.Error(err) - } -} - -func BenchmarkNopLoggerSimple(b *testing.B) { - benchmarkRunner(b, log.NewNopLogger(), baseMessage) -} - -func BenchmarkNopLoggerContextual(b *testing.B) { - benchmarkRunner(b, log.NewNopLogger(), withMessage) -} diff --git a/vendor/github.com/go-kit/kit/log/stdlib.go b/vendor/github.com/go-kit/kit/log/stdlib.go deleted file mode 100644 index ff96b5de..00000000 --- a/vendor/github.com/go-kit/kit/log/stdlib.go +++ /dev/null @@ -1,116 +0,0 @@ -package log - -import ( - "io" - "log" - "regexp" - "strings" -) - -// StdlibWriter implements io.Writer by invoking the stdlib log.Print. It's -// designed to be passed to a Go kit logger as the writer, for cases where -// it's necessary to redirect all Go kit log output to the stdlib logger. -// -// If you have any choice in the matter, you shouldn't use this. Prefer to -// redirect the stdlib log to the Go kit logger via NewStdlibAdapter. -type StdlibWriter struct{} - -// Write implements io.Writer. -func (w StdlibWriter) Write(p []byte) (int, error) { - log.Print(strings.TrimSpace(string(p))) - return len(p), nil -} - -// StdlibAdapter wraps a Logger and allows it to be passed to the stdlib -// logger's SetOutput. It will extract date/timestamps, filenames, and -// messages, and place them under relevant keys. -type StdlibAdapter struct { - Logger - timestampKey string - fileKey string - messageKey string -} - -// StdlibAdapterOption sets a parameter for the StdlibAdapter. -type StdlibAdapterOption func(*StdlibAdapter) - -// TimestampKey sets the key for the timestamp field. By default, it's "ts". -func TimestampKey(key string) StdlibAdapterOption { - return func(a *StdlibAdapter) { a.timestampKey = key } -} - -// FileKey sets the key for the file and line field. By default, it's "caller". -func FileKey(key string) StdlibAdapterOption { - return func(a *StdlibAdapter) { a.fileKey = key } -} - -// MessageKey sets the key for the actual log message. By default, it's "msg". -func MessageKey(key string) StdlibAdapterOption { - return func(a *StdlibAdapter) { a.messageKey = key } -} - -// NewStdlibAdapter returns a new StdlibAdapter wrapper around the passed -// logger. It's designed to be passed to log.SetOutput. -func NewStdlibAdapter(logger Logger, options ...StdlibAdapterOption) io.Writer { - a := StdlibAdapter{ - Logger: logger, - timestampKey: "ts", - fileKey: "caller", - messageKey: "msg", - } - for _, option := range options { - option(&a) - } - return a -} - -func (a StdlibAdapter) Write(p []byte) (int, error) { - result := subexps(p) - keyvals := []interface{}{} - var timestamp string - if date, ok := result["date"]; ok && date != "" { - timestamp = date - } - if time, ok := result["time"]; ok && time != "" { - if timestamp != "" { - timestamp += " " - } - timestamp += time - } - if timestamp != "" { - keyvals = append(keyvals, a.timestampKey, timestamp) - } - if file, ok := result["file"]; ok && file != "" { - keyvals = append(keyvals, a.fileKey, file) - } - if msg, ok := result["msg"]; ok { - keyvals = append(keyvals, a.messageKey, msg) - } - if err := a.Logger.Log(keyvals...); err != nil { - return 0, err - } - return len(p), nil -} - -const ( - logRegexpDate = `(?P[0-9]{4}/[0-9]{2}/[0-9]{2})?[ ]?` - logRegexpTime = `(?P